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: morgy.wahl@… 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 Aymeric Augustin)

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.)

Change History (1)

comment:1 by Aymeric Augustin, 13 years ago

Description: modified (diff)

Fixed formatting (you can use "preview" before submitting a ticket).

Note: See TracTickets for help on using tickets.
Back to Top