Opened 5 years ago
Closed 5 years ago
#31188 closed Bug (wontfix)
Query param values got converted to lists.
Reported by: | Davit Tovmasyan | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Steps to reproduce:
- Create a simple view
class SomeView(View): def get(self, request, *args, **kwargs): ... print(request.GET) ...
- Create URL pattern for the view as usual
... path('some/', SomeView.as_view()), ...
- Do a GET request with query param using Client from
django.test
... c = Client() c.get('some/', {'param': 1}) ...
Remember this print(request.GET)
code in CBV ?
The value is <QueryDict: {'param': ['1']}>
and not <QueryDict: {'param': '1'}>
as expected.
The same output when doing this way
... c = Client() c.get('some/?param=1') ...
Change History (1)
comment:1 by , 5 years ago
Component: | Testing framework → HTTP handling |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Summary: | Query param values got converted to lists when using Client from django.test → Query param values got converted to lists. |
Note:
See TracTickets
for help on using tickets.
This is an expected and documented behavior.