简体   繁体   中英

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

对于URL http://example.com/blah/?myvar=123&myvar=567您可以像这样使用getlist()

request.GET.getlist('myvar')

You can use %2C, wich is the url-encoded value of , .

source : Alternative to sending comma separated parameter by querystring

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM