7

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

1

2 Answers 2

14

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

request.GET.getlist('myvar')
Sign up to request clarification or add additional context in comments.

Comments

1

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

source : Alternative to sending comma separated parameter by querystring

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.