By mentioning an active_link variable while including the snippet of the navigation template, this solution is both simple and easy to implement.
In every template, you will need to include the following line (or inherit it):
{% include "_navbar.html" with active_link='link2' %}
The _navbar.html file contains the navigation menu with a set of checks for the active_link variable:
{# _navbar.html #} <ul class="nav nav-pills"> <li{% if active_link == "link1" %} class="active"{% endif %}><a href="{% url 'link1' %}">Link 1</a></li> <li{% if active_link == "link2" %} class="active"{% endif %}><a href="{% url 'link2' %}">Link 2</a></li> <li{% if active_link == "link3" %} class="active"{% endif %}><a href="{% url 'link3' %}">Link 3</a></li> </ul>