Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: How does view get multiple values from url?

Tags:

python

django

It's about passing values from URL to view in django.

URL like this: http:///boards/?board=picture&board=girls

I want get both values "picture" and "girls" that all belongs to board. Store these values to a list or something.

Obviously, request.GET.get('board') can't get two values.

Does anybody get a workaround? Thank you in advance.

like image 855
Alex.Zhang Avatar asked Jul 24 '12 14:07

Alex.Zhang


1 Answers

It's request.GET.getlist('board') - it's stated in the Django docs at https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict

like image 178
Jon Clements Avatar answered Nov 10 '22 09:11

Jon Clements