Sometimes, we want to pass query parameters via Python Django’s {% url %} template tag.
In this article, we’ll look at how to pass query parameters via Python Django’s {% url %} template tag.
How to pass query parameters via Python Django’s {% url %} template tag?
To pass query parameters via Python Django’s {% url %} template tag, we just append it after the URL.
For instance, in our template, we write
<a href="{% url 'myview' %}?office=foobar">
...
</a>
to add ?office=foobar
after the URL for the myview
view.
Conclusion
To pass query parameters via Python Django’s {% url %} template tag, we just append it after the URL.