Cromulent
Cromulent

Reputation: 3818

Using Django URLs with get query strings

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.

Upvotes: 0

Views: 137

Answers (1)

felipsmartins
felipsmartins

Reputation: 13559

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>

Upvotes: 2

Related Questions