Skip to content

Commit b8925e4

Browse files
authored
Add missing definition of PersonFilter to filtering.rst (jieter#840)
Add missing definition of PersonFilter
1 parent 4826a48 commit b8925e4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/pages/filtering.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ The basis of a filtered table is a `SingleTableMixin` combined with a
2121

2222
filterset_class = PersonFilter
2323

24+
The ``PersonFilter`` is defined the following way::
25+
26+
from django_filters import FilterSet
27+
from .models import Person
28+
29+
class PersonFilter(FilterSet):
30+
class Meta:
31+
model = Person
32+
fields = {"name": ["exact", "contains"], "country": ["exact"]}
2433

2534
The ``FilterSet`` is added to the template context in a ``filter`` variable by
2635
default. A basic template rendering the filter (using django-bootstrap3)[https://pypi.org/project/django-bootstrap3/] and

0 commit comments

Comments
 (0)