Skip to content

Sorting subsets of objects broken for Django 4.2? #263

Open
@eastface

Description

@eastface

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 <WSGIRequest: GET '/admin/gallery/slide/?sort_filter=0'>

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions