We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42fe33c commit 2947c9dCopy full SHA for 2947c9d
url_filter/backends/django.py
@@ -96,6 +96,11 @@ def filter_by_specs(self, queryset):
96
97
if include:
98
queryset = queryset.filter(**include)
99
+
100
+ # Plain queryset.exclude(**exclude) would cause exclusion of ALL
101
+ # negative-matching objects. I.e. x!=1&y!=2 is equivalent
102
+ # to "NOT (x = 1 AND y = 2)" SQL, which is not an intuitive behavior.
103
+ # We chain .exclude to achieve "NOT (x = 1) AND NOT (y = 2)" instead.
104
for lookup, value in exclude.items():
105
queryset = queryset.exclude(**{lookup: value})
106
0 commit comments