Skip to main content

Django template tags designed to help the navigation rendering

Project description

Build status

Django template tags to add active class on navigation menus

Prerequisites

  • Django 4.2

  • Python 3.10

Installation

From sources

python setup.py install

From PyPi

pip install django-navhelper==1.0

Configure your Django installation

Add geelweb.django.navhelper in your INSTALLED_APPS.

Template tags

renavactive

Returns “active” if the pattern is found in the request path

{% load navactive %}
<li class="{% renavactive request "^/start_with_foo" %}">
    <a href="{% url "view_name" }">Menu Entry</a>
</li>

Settings

You can customize some options using settings

NAVHELPER_ACTIVE_CLASS

Default: ‘active’

The class name for active entries

NAVHELPER_NOT_ACTIVE_CLASS

Default: ‘’ (Empty string)

The class name for non-active entries

Run test suite

To run the test suite, first, create and activate a virtual environment. Then install some requirements and run the tests:

pip install Django==4.2
python runtests.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-navhelper-1.0.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

django_navhelper-1.0.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page