I have this:
excl = dict()
kwargs['field1__isnull'] = False
kwargs['field2__isnull'] = False
kwargs['field3__isnull'] = False
items = MyModel.objects.filter(**kwargs).exclude(**excl)
And it generates this SQL:
SELECT ... FROM `mytable` WHERE (`field1` IS NULL AND `field2` IS NULL AND `field2` IS NULL)
But I want this:
SELECT ... FROM `mytable` WHERE (`field1` IS NULL AND `field2` IS NULL OR `field2` IS NULL)
How to do it (I must use kwargs dictionary, unless it can be combined with Q)?
Assuming danihp is correct with his question, I think you’d want something like this: