Wednesday, February 29, 2012

Re: Post data Query Dict - Why not a list ?

On 2012-02-29, at 09:46 , Szabo, Patrick (LNG-VIE) wrote:
> Hi,
> If i do
> for key in request.POST.keys():
> print request.POST[key]
> Over this (which is the result of print request.Post):
> <QueryDict: {u'hix': [u'Monatsreport'], u'my_choice_field': [u'2',
> u'29', u'42']}>
> I get:
> Monatsreport
> 42
> Should I not get lists ?

No, multidicts generally conform to the dict interface (mapping a
key to a value) as it's the most useful way to interact with POSTDATA
(or GETDATA for that matter): people will generally map a single value
to each key and having to unpack that value all the time is a pain.

If you want to get all values for the key, as the documentation
indicates[0] you should use the `getlist` method.


You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment