#25347: QueryDict can't return a list for a select multiple form element
-------------------------------+--------------------
Reporter: drakej | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I'm not sure why this is the case but QueryDict can't return a list object
for a multi select unless you explicitly call getlist. I'm not sure why
this is the case since it should be able to translate the POST or GET data
into the proper data structures.
"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."
This is from the documentation and it mentions that this custom class
around the post data is needed to support it, yet doesn't explain why it's
needed. No other language or framework I've worked with has this
limitation where you need to explicitly know the form element's "type"
before hand. This makes dynamically parsing the results impossible since
you need to know the type before you can actually access it correctly.
Further more I don't see how returning the last element of a list is
helpful in any real use cases. Clearly the class knows which data type it
is if it can properly access the list element.
--
Ticket URL: <https://code.djangoproject.com/ticket/25347>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.aef8fd4a66cee8129bfcca644cd4b7d9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.