#NEWLINE# def _add_q( self , q_object , used_aliases , branch_negated = False , current_negated = False , allow_joins = True , split_subq = True ) : #NEWLINE# #INDENT# '\n        Adds a Q-object to the current filter.\n        ' #NEWLINE# connector = q_object . connector #NEWLINE# current_negated = ( current_negated ^ q_object . negated ) #NEWLINE# branch_negated = ( branch_negated or q_object . negated ) #NEWLINE# target_clause = self . where_class ( connector = connector , negated = q_object . negated ) #NEWLINE# joinpromoter = JoinPromoter ( q_object . connector , len ( q_object . children ) , current_negated ) #NEWLINE# for child in q_object . children : #NEWLINE# #INDENT# if isinstance ( child , Node ) : #NEWLINE# #INDENT# ( child_clause , needed_inner ) = self . _add_q ( child , used_aliases , branch_negated , current_negated , allow_joins , split_subq ) #NEWLINE# joinpromoter . add_votes ( needed_inner ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( child_clause , needed_inner ) = self . build_filter ( child , can_reuse = used_aliases , branch_negated = branch_negated , current_negated = current_negated , connector = connector , allow_joins = allow_joins , split_subq = split_subq ) #NEWLINE# joinpromoter . add_votes ( needed_inner ) #NEWLINE# #UNINDENT# if child_clause : #NEWLINE# #INDENT# target_clause . add ( child_clause , connector ) #NEWLINE# #UNINDENT# #UNINDENT# needed_inner = joinpromoter . update_join_types ( self ) #NEWLINE# return ( target_clause , needed_inner )