negation of Q object returns the same thing
|Reported by:||morgy.wahl@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by aaugustin)
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.)