#NEWLINE# def add_alias_constraints( queryset , alias , **kwargs ) : #NEWLINE# #INDENT# ( model , alias ) = alias #NEWLINE# clause = queryset . query . where_class ( ) #NEWLINE# for ( lookup , value ) in kwargs . items ( ) : #NEWLINE# #INDENT# ( field_name , lookup ) = lookup . split ( '__' ) #NEWLINE# field = model . _meta . get_field ( field_name ) #NEWLINE# clause . add ( ( Constraint ( alias , field . column , field ) , lookup , value ) , AND ) #NEWLINE# #UNINDENT# queryset . query . where . add ( clause , AND )