> I have a form on one of my pages that has two fields with the same
> name. When I process the POST in my view I only get one of the values
> ( the last one ).
>
> EXAMPLE:
> HTML
> <input name="version" value="38" type="checkbox">
> <input name="version" value="35" type="checkbox">
>
> DEBUG
> POST:<MultiValueDict: {u'version': [u'38', u'35']}>
>
> VIEW
> request.POST['version']
>
> the above line is = 35 if both checkboxes are checked
>
> any ideas why I don't get a list with (38,35)?
You have to use the getlist method [1] to retrieve a list of parameters:
request.POST.getlist('version')
Regards,
Jonathan.
[1]
http://www.djangoproject.com/documentation/request_response/#querydict-objects
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---