#37340 assigned Bug

admin.add_preserved_filters() drops repeated query parameters

Reported by: ollehu Owned by: ollehu
Component: Forms Version: 6.1
Severity: Normal Keywords:
Cc: ollehu Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django.contrib.admin.templatetags.admin_urls.add_preserved_filters() loses repeated query parameters when restoring changelist filters from an admin change form.

Reproduction

Use a changelist URL containing repeated parameters:

/admin/?X__id__exact=57&X__id__exact=54

After opening an object, the change form receives:

_changelist_filters=X__id__exact%3D57%26X__id__exact%3D54

The admin Close/back URL is then generated as:

/admin/?X__exact=54

The first value has been discarded.

Cause

add_preserved_filters() repeatedly converts parse_qsl() results to a regular dictionary.

I have a fix prepared that we already use in a fork and can issue a PR when this gets accepted.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top