Opened 9 years ago

Closed 9 years ago

#26574 closed New feature (needsinfo)

Need to do bitwise operations in where clause

Reported by: awol Owned by: nobody
Component: Database layer (models, ORM) Version: 1.9
Severity: Normal Keywords: QuerySet.extra
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

We receive a bitmask in a field from an external source and we need to do bitwise comparisons (of some complexity) with this field when selecting from the table in question. The bitwise operators are supported by the postgres backend. Deprecating the QuerySet.extra would make that hard/impossible I think.

Change History (2)

comment:1 by Tim Graham, 9 years ago

From the docs:

 The F() objects support bitwise operations by .bitand() and .bitor(), for example:

     >>> F('somefield').bitand(16)

If this isn't sufficient, could you give an example usage of QuerySet.extra() that you aren't able to replace?

Version 0, edited 9 years ago by Tim Graham (next)

comment:2 by Tim Graham, 9 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: needsinfo
Status: newclosed
Type: UncategorizedNew feature
Note: See TracTickets for help on using tickets.
Back to Top