Opened 6 years ago

Closed 6 years ago

#29121 closed Bug (invalid)

Admin ChangeList trims off multi-valued query parameters

Reported by: Jeffrey Bian Owned by: nobody
Component: contrib.admin Version: dev
Severity: Normal Keywords: custom ChangeList admin
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In contrib.admin.views.main module - ChangeList class constructor, when populating self.params with GET query parameters, it converts it into a single valued dict.
E.g., for customized parameters like "tag=1&tag=10&tag=3", only one value will be preserved.

https://github.com/django/django/blob/master/django/contrib/admin/views/main.py#L66

Suggested fix:

Instead of calling request.GET.items(), usse request.GET.lists() so to preserve all values. Thus the line reads:

self.params = dict(request.GET.lists())

This will flatten the dict while making the multiple values of a key into a list.

Patch below in attachment.

Regards,

Attachments (1)

fix_changelist_params.patch (987 bytes ) - added by Jeffrey Bian 6 years ago.
This patch is against master branch

Download all attachments as: .zip

Change History (2)

by Jeffrey Bian, 6 years ago

Attachment: fix_changelist_params.patch added

This patch is against master branch

comment:1 by Jeffrey Bian, 6 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top