Template tags

Swingers’ custom template tags.

swingers.templatags.active.active()

Calculates whether the url passed to the tag is the currently active url. Takes request as the first argument, and a list of urls afterwards. Returns 'active' if it is, '' otherwise.

Sample usage:

{% load active %}

{% url 'weatherdata_list' as weatherdata_list %}

<li class="dropdown {% active request weatherdata_list %}">
{# rest of navigation #}

Django-swingers is a library of common utilities, templates and other django customizations used throughout Department of Parks and Wildlife.

Related Topics