8

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.

Alex.Zhang
  • 307
  • 2
  • 8
  • 1
    maybe this question helps http://stackoverflow.com/questions/3910165/problem-with-django-request-get-and-multiple-variables-for-the-same-parameter-na – endre Jul 24 '12 at 14:54

1 Answers1

16

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

Jon Clements
  • 138,671
  • 33
  • 247
  • 280
  • @Jon Is there a documentation that says its OK to use multiple arguments in GET request with same name? (e.g. `board` in the above question has 2 values, is that a request that conforms to specs?) – user Jul 08 '14 at 13:26