jazzband / jazzband/django-admin-sortable

SortableAdmin does not work with SimpleListFilter

Open
#264 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
569
Forks
138
PR merge metrics
No merged PRs in 30d

Description

When model admin is subclass of SortableAdmin and SimpleListFilter is used FieldError exception is raised.
This is because SimpleListFilter defines `parameter_name` and SortableAdmin tries to filter by this field.

This is done in:
https://github.com/jazzband/django-admin-sortable/blob/master/adminsortable/admin.py#L56

Workaround is to override `get_querystring_filters` in `SortableAdmin` subclass and remove any parameter used in `SimpleListFilter`.

I have added minimal test case for this issue in https://github.com/bmihelac/django-admin-sortable/tree/tmp/issue-264-SimpleListFilter

To reproduce:
1. run django devserver
2. go to http://127.0.0.1:8000/admin/samples/category/
3. select any value from filter

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.