#31188: Query param values got converted to lists when using Client from
django.test
---------------------------------------------+------------------------
Reporter: Davit Tovmasyan | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | 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 |
---------------------------------------------+------------------------
Steps to reproduce:
1. Create a simple view
{{{
#!python
class SomeView(View):
def get(self, request, *args, **kwargs):
...
print(request.GET)
...
}}}
2. Create URL pattern for the view as usual
{{{
#!python
...
path('some/', SomeView.as_view()),
...
}}}
3. Do a GET request with query param using Client from `django.test`
{{{
#!python
...
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
{{{
#!python
...
c = Client()
c.get('some/?param=1')
...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31188>
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/056.9646b860436a26aa0d846d4b3fa72598%40djangoproject.com.