diff --git a/wagtail/admin/views/generic/base.py b/wagtail/admin/views/generic/base.py index f552d978c4..ffd5208007 100644 --- a/wagtail/admin/views/generic/base.py +++ b/wagtail/admin/views/generic/base.py @@ -201,7 +201,7 @@ class BaseListingView(WagtailAdminTemplateMixin, BaseListView): @cached_property def filters(self): if self.filterset_class: - filterset = self.filterset_class(self.request.GET, request=self.request) + filterset = self.filterset_class(**self.get_filterset_kwargs()) # Don't use the filterset if it has no fields if filterset.form.fields: return filterset @@ -213,6 +213,12 @@ class BaseListingView(WagtailAdminTemplateMixin, BaseListView): self.filters and self.filters.is_valid() and self.filters.form.has_changed() ) + def get_filterset_kwargs(self): + return { + "data": self.request.GET, + "request": self.request, + } + def filter_queryset(self, queryset): if self.filters and self.filters.is_valid(): queryset = self.filters.filter_queryset(queryset)