#NEWLINE# def get_condition( self ) : #NEWLINE# #INDENT# '\n        Determines the condition to be used in the condition part of the join sql.\n\n        :return: The condition for the join clause\n        :rtype: str or None\n        ' #NEWLINE# if self . condition : #NEWLINE# #INDENT# return self . condition #NEWLINE# #UNINDENT# if ( ( type ( self . right_table ) is ModelTable ) and ( type ( self . right_table ) is ModelTable ) ) : #NEWLINE# #INDENT# for field in self . right_table . model . _meta . get_all_related_objects ( ) : #NEWLINE# #INDENT# related_model = field . model #NEWLINE# if hasattr ( field , 'related_model' ) : #NEWLINE# #INDENT# related_model = field . related_model #NEWLINE# #UNINDENT# if ( related_model == self . left_table . model ) : #NEWLINE# #INDENT# table_join_field = condition . field . column #NEWLINE# condition = '{0}.{1} = {2}.{3}' . format ( self . right_table . get_identifier ( ) , self . right_table . model . _meta . pk . name , self . left_table . get_identifier ( ) , table_join_field ) #NEWLINE# return condition #NEWLINE# #UNINDENT# #UNINDENT# for field in self . right_table . model . _meta . fields : #NEWLINE# #INDENT# if ( ( field . get_internal_type ( ) == 'OneToOneField' ) or ( field . get_internal_type ( ) == 'ForeignKey' ) ) : #NEWLINE# #INDENT# if ( field . rel . to == self . left_table . model ) : #NEWLINE# #INDENT# table_join_field = field . column #NEWLINE# condition = '{0}.{1} = {2}.{3}' . format ( self . right_table . get_identifier ( ) , table_join_field , self . left_table . get_identifier ( ) , self . left_table . model . _meta . pk . name ) #NEWLINE# return condition #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return None