jazzband / jazzband/django-admin-sortable

Sorting subsets of objects broken for Django 4.2?

Open
#263 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

I am using a sorting_filters tuple to filter subsets of objects. This was working fine previously, and I suspect it stopped working when I upgraded to Django 4 (though I haven't fully checked that).

The error I see is

`Cannot resolve keyword 'sort_filter' into field.`

And debug shows

`filters {'sort_filter': '0'}`
`request `

at line 60 in `changelist_view` of django-admin-sortable/adminsortable/admin.py.

It looks to me like the `sort_filter` in the querystring should **not** be parsed into `filters`. This is done in the `get_querystring_filters` method which already ignores keys `IGNORED_PARAMS` and `PAGE_VAR`. By also ignoring `sort_filter` and `e` (which can also get in there). My code is working again.

I hope this is useful and allows someone to spot the correct quick fix.

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.