#NEWLINE# def check_query_object_type( self , value , opts , field ) : #NEWLINE# #INDENT# '\n        Checks whether the object passed while querying is of the correct type.\n        If not, it raises a ValueError specifying the wrong object.\n        ' #NEWLINE# if hasattr ( value , '_meta' ) : #NEWLINE# #INDENT# if ( not check_rel_lookup_compatibility ( value . _meta . model , opts , field ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Cannot query "%s": Must be "%s" instance.' % ( value , opts . object_name ) ) )