Skip to main content

django-bootstrap-navbar

Code style: black coverage report

A code based navbar with great ambitions.

django-navbar

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:

  1. 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",
            ]
        },
    }
]
  1. 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.

Release files for django-bootstrap-navbar 0.0.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-bootstrap-navbar 0.0.22
File Size Uploaded
django_bootstrap_navbar-0.0.22.tar.gz 9.1 kB Details

Release files / django_bootstrap_navbar-0.0.22.tar.gz

Download URL django_bootstrap_navbar-0.0.22.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a9e5eadb9917502611bbad7b6ffeb7702f0145245b8b43fbe74749f1f3811b9b
BLAKE2b-256 checksum
How to use checksums
476c1c36bc9e60201db1e04f51fa5dcf7563590ed5f59758f012f4363bcb042a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.0.22 This release

1 release file

0.0.21

2 release files

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page