Opened 13 years ago
Last modified 4 years ago
#16893 closed Bug
negation of Q object returns the same thing — at Version 1
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Not sure if this is a bug.
I was attempt to construct a Q object that wouldn't ever match anything (an API calls for a Q object to be returned, but certain situations call for nothing to be matched by it). I initially figured ~ Q()
would do the trick, but that matches everything, just like a plain Q()
.
(I ended up using Q(pk__isnull=True)
, which is a hack but seems to be OK.)
Note:
See TracTickets
for help on using tickets.
Fixed formatting (you can use "preview" before submitting a ticket).