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
Close
Hashes for django_bootstrap_navbar-0.0.19.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b637524d525d441d2c404d9b49303c27e7480fc2189476cf66cd01583b7b4cc0 |
|
MD5 | 972b4d2af9a6ee8188f50eb1b73f6d31 |
|
BLAKE2b-256 | bfed02fae7b0bea82457698bda9d2fedcdf8b15c12b805fd2dee97319c6ef03d |