def get_db_prep_lookup(self, lookup_type, value, connection=None, 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.name, value)
     if connection is None:
         return BigIntegerField.get_db_prep_lookup(self, lookup_type=lookup_type, value=value)
     return BigIntegerField.get_db_prep_lookup(self, lookup_type=lookup_type, value=value,
                                                     connection=connection, prepared=prepared)
Beispiel #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 [value.mask]
     return BigIntegerField.get_db_prep_lookup(self, lookup_type=lookup_type, value=value,
                                               connection=connection, prepared=prepared)
 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)
 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)
Beispiel #5
0
    def get_db_prep_lookup(self,
                           lookup_type,
                           value,
                           connection,
                           prepared=False):
        if isinstance(value, (BitHandler, Bit)):
            raise NotImplementedError(
                "get_db_prep_lookup not supported with types Bit, BitHandler")

        return BigIntegerField.get_db_prep_lookup(self,
                                                  lookup_type=lookup_type,
                                                  value=value,
                                                  connection=connection,
                                                  prepared=prepared)
 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, Bit):
         return BitQueryLookupWrapper(self.model._meta.db_table, self.name,
                                      value)
     return BigIntegerField.get_db_prep_lookup(self,
                                               lookup_type=lookup_type,
                                               value=value,
                                               connection=connection,
                                               prepared=prepared)