Rich - enzedonline
Rich - enzedonline

Reputation: 1258

Compatibility issues using a django_filters.RangeFilter with WagtailFilterSet

I'm trying to create a range filter on an integer column in a list view in Wagtail but I seem to have run into compatibility issues.

In my filter class, I define the filter on my count column with:

use_count = django_filters.RangeFilter(field_name='count', label="Usage Count")

The filter works but the filter badge above the listing is not very user friendly, giving a slice notation rather than something more human readable.

appearance of the range filter in wagtail admin

The next issue is that the filter won't dismiss from the clear (X) button.

Looking at the console, on clicking the dismiss button, I see the values for the count filter remain in the query string:

[06/Dec/2024 13:23:02] "GET /admin/snippets/news/category/results/?title=&slug=&count_min=1&count_max=10&_w_filter_fragment=1 HTTP/1.1" 200 22014

The only way to clear it is to clear the values from the filter input boxes.

I'm not sure if this is a bug or there are extra steps I need to add in here to get it to work as expected, I couldn't find an existing example to work off in the core code.

Any help with this appreciated.

Upvotes: 0

Views: 20

Answers (0)

Related Questions