示例#1
0
 def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):
     if isinstance(getattr(value, 'expression', None), Bit):
         value = value.expression
     if isinstance(value, (BitHandler, Bit)):
         if hasattr(self, 'class_lookups'):
             # Django 1.7+
             return [value.mask]
         else:
             return BitQueryLookupWrapper(self.model._meta.db_table, self.db_column or self.name, value)
     return BigIntegerField.get_db_prep_lookup(self, lookup_type=lookup_type, value=value,
                                               connection=connection, prepared=prepared)
示例#2
0
 def get_db_prep_lookup(self,
                        lookup_type,
                        value,
                        connection,
                        prepared=False):
     if isinstance(value, SQLEvaluator) and isinstance(
             value.expression, Bit):
         value = value.expression
     if isinstance(value, (BitHandler, Bit)):
         return BitQueryLookupWrapper(self.model._meta.db_table,
                                      self.db_column or self.name, value)
     return BigIntegerField.get_db_prep_lookup(self,
                                               lookup_type=lookup_type,
                                               value=value,
                                               connection=connection,
                                               prepared=prepared)