Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SortableAdmin does not work with SimpleListFilter #264

Open
bmihelac opened this issue Dec 5, 2023 · 0 comments
Open

SortableAdmin does not work with SimpleListFilter #264

bmihelac opened this issue Dec 5, 2023 · 0 comments

Comments

@bmihelac
Copy link

bmihelac commented Dec 5, 2023

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
bmihelac added a commit to bmihelac/django-admin-sortable that referenced this issue Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant