#31338: ChangeList parses querystring incorrectly
-----------------------------------------+------------------------
Reporter: thasmin | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
The ChangeList class in django.contrib.admin does not correctly handle
querystrings generated by <select multiple> elements. These elements
create querystrings like `?filter=val1&filter=val2`. The ChangeList
constructor loses all but the last value when it assigns
`dict(request.GET.items())` to params on this line:
https://github.com/django/django/blob/3.0.3/django/contrib/admin/views/main.py#L87
Here’s a code snippet illustrating the problem:
{{{
from django.http import QueryDict
qd = QueryDict("key=val1&key=val2&key=val3")
assert qd.getlist("key") == ["val1", "val2", "val3"] # correct
d = dict(qd.items())
assert d["filter"] == "val3" # loses val1 and val2
}}}
This has been reported before https://code.djangoproject.com/ticket/29121
but the author didn't address the problems with changing the type of
`ChangeList.params` and was marked invalid without comment.
--
Ticket URL: <https://code.djangoproject.com/ticket/31338>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.e6e4d5da6507dcb28706b8e9e4ae3cdf%40djangoproject.com.