Project description

Django template tags to add active class on navigation menus
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
navactive
Returns “active” if url name of the current request path is in the list
of view names
{% load navactive %}
<li class="{% navactive request "view_name app_name:another_view_name namespace:" %}">
<a href="{% url "view_name" }">Menu Entry</a>
</li>
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
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
File details
Details for the file django-navhelper-1.0.0.tar.gz.
File metadata
-
Download URL: django-navhelper-1.0.0.tar.gz
- Upload date:
-
Size: 4.4 kB
- Tags: Source
-
Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
Hashes for django-navhelper-1.0.0.tar.gz
| Algorithm |
Hash digest |
|
| SHA256 |
ea7bf447187e23566db11daccbf87693dff410c7d0b036c9397c8f1c0bf7d6f6
|
|
| MD5 |
f34d0773ec38ac9694f5a4864bca246a
|
|
| BLAKE2b-256 |
6ff880c86f01c3b5c2d96e587a4be8358988fd59b278dd37922bef5531e30285
|
|
See more details on using hashes here.
File details
Details for the file django_navhelper-1.0.0-py3-none-any.whl.
File metadata
File hashes
Hashes for django_navhelper-1.0.0-py3-none-any.whl
| Algorithm |
Hash digest |
|
| SHA256 |
2062fda7799a5bb8d7aadb9750702ff6afa45f5f485a48b84c6ff4cca6a8678c
|
|
| MD5 |
cba53ea6d1b78c56345d3256fadf3c4b
|
|
| BLAKE2b-256 |
1b01ab5bfcc0382f92520a5e974d34cfdcce49744862ad751a4a6c5158dcca77
|
|
See more details on using hashes here.