Skip to content

Commit 783b592

Browse files
authored
Add filterset_fields lookup expresson to docs (#1460)
1 parent d693a59 commit 783b592

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/guide/tips.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ would be:
3737

3838
class ProductFilter(django_filters.FilterSet):
3939
price__gt = django_filters.NumberFilter(field_name='price', lookup_expr='gt')
40+
41+
When using ``filterset_fields``, you can also add the ``lookup_expr`` in the
42+
dict of fields like so:
43+
44+
.. code-block:: python
45+
# ... ModelViewSet with DjangoFilterBackend in filter_backends ...
46+
47+
filterset_fields = {
48+
"price": ["gt", "exact"],
49+
}
4050

4151

4252
Missing ``lookup_expr`` for text search filters

0 commit comments

Comments
 (0)