Skip to content

Commit b6aa6e1

Browse files
author
Ryan P Kilby
committed
Add exclusion documentation to the README
1 parent 4fc5fac commit b6aa6e1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,20 @@ then we can filter like so::
164164

165165
/api/page/?author__username__icontains=john
166166

167+
Automatic Filter Negation/Exclusion
168+
~~~~~~~~~~~~~~~~~~~~~~~~~
169+
170+
FilterSets also support automatic exclusion using a simple ``k!=v`` syntax. This syntax
171+
internally sets the ``exclude`` property on the filter.
172+
173+
/api/page/?title!=The%20Park
174+
175+
This syntax supports regular filtering combined with exclusion filtering. For example,
176+
the following would search for all articles containing "Hello" in the title, while
177+
excluding those containing "World".
178+
179+
/api/articles/?title__contains=Hello&title__contains!=World
180+
167181
DjangoFilterBackend
168182
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169183

0 commit comments

Comments
 (0)