Skip to main content

A package that provides a simple way to add breadcrumbs to your Django views

Project description

Django Breadcrumbs Utils Django Breadcrumbs Utils is a package that provides a simple way to add breadcrumbs to your Django views.

Installation You can install the package via pip:

Copy code pip install django-breadcrumbs-utils Usage To use the custom_path function from the package, import it into your urls.py file and use it to define your URL patterns:

python Copy code from breadcrumbs import custom_path

urlpatterns = [ custom_path('my-route/', my_view, name='my-view', breadcrumb='My View'), # ... ] The custom_path function takes a route argument, a view function, a name argument (optional), and a breadcrumb argument (optional).

The breadcrumb argument should be a string that represents the label of the breadcrumb for the current page.

The custom_path function wraps your view function with a decorator that adds a breadcrumb variable to the context of the view function. The variable contains the breadcrumb label specified in the breadcrumb argument.

In your template, you can access the breadcrumb variable to display the breadcrumb:

html Copy code {% block breadcrumbs %}

{% endblock %}

This will display a breadcrumb trail that starts with a link to the home page and ends with an active breadcrumb label for the current page.

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-breadcrumbs-util-1.1.tar.gz (1.8 kB view hashes)

Uploaded Source

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