Return to Snippet

Revision: 43537
at March 26, 2011 00:27 by magicrebirth


Initial Code
# getting multiple values:

testargs = request.GET.getlist('testargs')   
# getlist gets all parameters with same name!!!!



# constructing the url:

>>> from django.http import QueryDict
>>> q = QueryDict(‘artists=1′).copy()
>>> my_artists = [11,22,33,44]
>>> q.setlist(‘artists’, my_artists)
>>> print q
<QueryDict: {u’artists’: [11, 22, 33, 44]}>
>>> print q.urlencode()
artists=11&artists=22&artists=33&artists=44

Initial URL
http://www.djangofoo.com/93/request-post-get-multiple-values

Initial Description

                                

Initial Title
request: get multiple values | Django

Initial Tags
post

Initial Language
Django