django-ifnav-templatetag /

Filename Size Date modified Message
60 B
45 B
136 B
168 B
825 B
1.5 KB
126 B
818 B
479 B
161 B

ifnav-Tag for Django Templates

The ifnav-Tag is used to match the current request path against a regular expression.


{% load ifnav %} <ul>

<li{% ifnav "^/foo/" %} class="selected"{% endifnav %}
<a href="/foo/">Foo</a></li>
<li{% ifnav "^/bar/" %} class="selected"{% endifnav %}
<a href="/bar/">Bar</a></li>


This tag is meant for rather simple and static navigations.

In order to use this tag you have to enable the request context processor, which comes with django, but is disabled by default:

Alternatively you can also set the request object in the template context directly.