Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I retrieve multiple query parameter values with Django?

My url has http://127.0.0.1:8000/theme/category/?q=check,hello, How to retrive values of query parameter

When I try doing query = request.GET.get('q') I only get the check but hello is missing.

Any help in getting both check and hello from query string will be helpful

like image 232
Coeus Avatar asked Dec 25 '22 02:12

Coeus


1 Answers

For the URL http://example.com/blah/?myvar=123&myvar=567 you can use getlist() like this:

request.GET.getlist('myvar')
like image 91
Or Duan Avatar answered Apr 28 '23 00:04

Or Duan