query.py 579 B

123456789101112131415
  1. from django.db.models.lookups import Exact
  2. from bitfield.types import Bit, BitHandler
  3. class BitQueryExactLookupStub(Exact):
  4. def get_db_prep_lookup(self, value, connection, prepared=False):
  5. if isinstance(value, (BitHandler, Bit)):
  6. raise NotImplementedError("get_db_prep_lookup not supported for Bit, BitHandler")
  7. return super().get_db_prep_lookup(value, connection)
  8. def get_prep_lookup(self):
  9. if isinstance(self.rhs, (Bit,)):
  10. raise NotImplementedError("get_db_prep_lookup not supported for Bit")
  11. return self.rhs