In Django ORM, how does one go about creating a Q object that is always False?
This is similar to the question about always True Q objects, but the other way round.
Note that this doesn't work:
Foobar.objects.filter(~Q()) # returns a queryset which gives all objects
Why do I want a Q object instead of the simple False value? So that I can combine it with other Q values, like this for example:
condition = always_true_q_object
if something_or_other:
condition = condition | foobar_that_returns_a_q_object()
if something_or_other2:
condition = condition | foobar_that_returns_a_q_object2()
.exclude(Q())
?..False
itself?1=0
and1=1
used for this purpose in MySQL queries. It seems silly that I can't do this simply in Django.