A simple Django navigation template tag
Project description
A simple Django template tag to handle navigation item selection.
Usage
Add the app to your INSTALLED_APPS setting:
INSTALLED_APPS = (
# ...
'django_navtag',
)
Give your base template a navigation block something like this:
{% load navtag %}
{% block nav %}
{% nav text ' class="selected"' %}
<ul class="nav">
<li{{ nav.home }}><a href="/">Home</a></li>
<li{{ nav.about }}><a href="/about/">About</a></li>
</ul>
{% endblock %}
In your templates, extend the base and set the navigation location:
{% extends "base.html" %}
{% block nav %}
{% nav "home" %}
{{ block.super }}
{% endblock %}
Using a different context variable
By default, this tag creates a nav context variable. To use an alternate context variable name, call {% nav [item] for [var_name] %}:
{% block nav %}
{% nav "home" for sidenav %}
{{ block.super }}
{% endblock %}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters