0

I use the url template tag with named URLs all the time in Django but now I need to be able to pass query strings to a couple of URLs in a Django template. Is this possible to do? The url template tag documentation does not mention GET query strings at all and hardcoding in URLs is bad practice if you ever want to change the URL in the future you also need to change the templates.

0

1 Answer 1

2

Well, I do not quite understand but... I think you want something like this:

<a title="" href="{% url my_url %}?foo=bar&spam=eggs">My link</a>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for that. It would be nice if there was some form of integrated syntax to do the same thing.

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.