http://localhost:8000/api/quote?from_currency_code=EUR&amount=300&to_currency_code=ILS
{{{
from django.shortcuts import render
def print_params(**kwargs):
print(*kwargs.items())
async def index(request):
print_params(**request.GET)
}}}
results in this
{{{
('from_currency_code', ['EUR']) ('amount', ['300']) ('to_currency_code',
['ILS'])
}}}
This is an odd behavior. request.GET.items() has the expected result.
--
Ticket URL: <https://code.djangoproject.com/ticket/32561>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
This is expected behaviour of `QueryDict`.
[https://docs.djangoproject.com/en/3.1/ref/request-response/#querydict-
objects From the docs]:
> In an HttpRequest object, the GET and POST attributes are instances of
django.http.QueryDict, a dictionary-like class customized to deal with
multiple values for the same key. This is necessary because some HTML form
elements, notably <select multiple>, pass multiple values for the same
key.
(The underlying storage is a list.)
This issue tracker is not really the appropriate place for this kind of
query. Please see TicketClosingReasons/UseSupportChannels.
--
Ticket URL: <https://code.djangoproject.com/ticket/32561#comment:1>