Skip to content

Commit

Permalink
#100 some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ephes committed Aug 23, 2023
1 parent 2bbf22f commit 3d456cc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cast/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ def set_facet_counts(self, queryset: models.QuerySet) -> None:


class PostFilterset(django_filters.FilterSet):
"""
A filterset for posts. It is used to filter the posts faceted navigation
style. The filterset facets are configured via the CAST_FILTERSET_FACETS setting.
The main reason why this code is confusing is that the facets are used
as the choices for the filterset fields. But the facets are only available
if the queryset is filtered. So the choices of the fields need to be set
after the queryset is filtered.
"""

search = django_filters.CharFilter(field_name="search", method="fulltext_search", label="Search")
date = django_filters.DateFromToRangeFilter(
field_name="visible_date",
Expand Down

0 comments on commit 3d456cc

Please sign in to comment.