#NEWLINE# def prepare_lookup_value( self , value , lookups , can_reuse , allow_joins = True ) : #NEWLINE# #INDENT# used_joins = [ ] #NEWLINE# if ( len ( lookups ) == 0 ) : #NEWLINE# #INDENT# lookups = [ 'exact' ] #NEWLINE# #UNINDENT# if ( value is None ) : #NEWLINE# #INDENT# if ( lookups [ ( - 1 ) ] not in ( 'exact' , 'iexact' ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Cannot use None as a query value' ) #NEWLINE# #UNINDENT# lookups [ ( - 1 ) ] = 'isnull' #NEWLINE# value = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( value , 'resolve_expression' ) : #NEWLINE# #INDENT# pre_joins = self . alias_refcount . copy ( ) #NEWLINE# value = value . resolve_expression ( self , reuse = can_reuse , allow_joins = allow_joins ) #NEWLINE# used_joins = [ k for ( k , v ) in self . alias_refcount . items ( ) if ( v > pre_joins . get ( k , 0 ) ) ] #NEWLINE# #UNINDENT# #UNINDENT# if ( hasattr ( value , 'query' ) and hasattr ( value . query , 'bump_prefix' ) ) : #NEWLINE# #INDENT# value = value . _clone ( ) #NEWLINE# value . query . bump_prefix ( self ) #NEWLINE# #UNINDENT# if hasattr ( value , 'bump_prefix' ) : #NEWLINE# #INDENT# value = value . clone ( ) #NEWLINE# value . bump_prefix ( self ) #NEWLINE# #UNINDENT# if ( connections [ DEFAULT_DB_ALIAS ] . features . interprets_empty_strings_as_nulls and ( lookups [ ( - 1 ) ] == 'exact' ) and ( value == '' ) ) : #NEWLINE# #INDENT# value = True #NEWLINE# lookups [ ( - 1 ) ] = 'isnull' #NEWLINE# #UNINDENT# return ( value , lookups , used_joins )