Instead of hardcoding all links, you can use built-in Django reverse urls. If you were to change a url path, you will not have to update all urls manually if you use reverse urls. In Django template you can use the {% url %}
tag.
{% url 'url_name' %}
url_name needs to be replaced with the name of the url.
If you have to pass arguments for the url, you can also include them.
{% url 'url_name' 'arg1' 'arg2' %}
Comments
Add comment