Skip to content

Commit

Permalink
Add filterset_fields lookup expresson to docs (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvacek authored Nov 29, 2023
1 parent d693a59 commit 783b592
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/guide/tips.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ would be:

class ProductFilter(django_filters.FilterSet):
price__gt = django_filters.NumberFilter(field_name='price', lookup_expr='gt')

When using ``filterset_fields``, you can also add the ``lookup_expr`` in the
dict of fields like so:

.. code-block:: python
# ... ModelViewSet with DjangoFilterBackend in filter_backends ...

filterset_fields = {
"price": ["gt", "exact"],
}


Missing ``lookup_expr`` for text search filters
Expand Down

0 comments on commit 783b592

Please sign in to comment.