This is a standard encode/decode situation you are descibing. Django
automatically decodes the GET string the the browser encodes. If you
need spaces, then they wil be encoded and decoded appropriately, so
don't worry about that.

If you want to pass a list in the GET string, do:

url?var=1&var=2&var=3

Django will intepret this in it's multi-value dict implementation that
QueryDict uses. So if you do:

request.GET.getlist('var')

you will get:

['1', '2', '3']

Hope that helps, Euan


On 10 July, 23:40, Margie Roginski <margierogin...@yahoo.com> wrote:
> I have a url in my app that needs to get info from a GET param.  For
> example, let's say my url is retrieving books by any of a set of
> authors, so the url might be this to get books authored by smith,
> johnson, or klein:
>
> www.example.com/books/?author=smith+johnson+klein
>
> I notice that when I look at request.GET.get('author') on the server,
> the '+' is gone and replaced by space:
>
> <QueryDict: {'u'author': [u'foo bar']}>
>
> Is this django doing this for me or is this some sort of general http
> protocal thing?
>
> My main question is just - what's the accepted way to pass in a get
> parameter that contains a bunch of times.  What if the parameter
> itself has spaces?  I've seen this '+' used - is that standard or just
> personal preference?
>
> Thanks,
> Margie

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to