Django navbar package
Project description
django-bootstrap-navbar
A code based navbar with great ambitions.
Usage
django-bootstrap-navbar lets you create a bootstrap 4 navbar with a Python class. It then takes care of setting the active class on the appropriate link based on the current path.
Install
The library is available on PyPi.
pip install django-bootstrap-navbar
Once you have created a navbar class there are two ways of making it available in your template context:
- Using the provided context processor
BOOTSTRAP_NAVBAR = "showcase.navbar:ExampleNavBar"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
...
"context_processors": [
"django.template.context_processors.debug",
...
"bootstrap_navbar.navbars.context_processors.navbar",
]
},
}
]
- Using the provided mixin
class ContextProcessorView(BootstrapNavBarViewMixin, TemplateView):
template_name = "index.html"
navbar_class = AppNavBar
Finally the navbar can be rendered within your templates by calling the navbar.render method.
{{ navbar.render }}
A full example is available within the repo.
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
Close
Hashes for django_bootstrap_navbar-0.0.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0da954f5904a6c63a34f18b09c754f0f0defa3894865edd25d49ed0749b63701 |
|
MD5 | d9e7f2875c37f92d8f4c378048517638 |
|
BLAKE2b-256 | 6e41d5d920c1224db1156dbff562df56b81ade984ec0417c36c7d0842f278a95 |
Close
Hashes for django_bootstrap_navbar-0.0.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da9adf43c5870e3786378819b7fef79dd77be587824f4f19cb4fbff848de1d05 |
|
MD5 | 108e7224b2c7c9ce49c3c05fd8122708 |
|
BLAKE2b-256 | 9fd6a264012cafc37702c1dedd5d4066b68a9251c051cd7ab5ea2701751402ab |