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
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
Hashes for django-breadcrumbs-util-1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bee651f7f3cea346c42c8586bc3bbe455965b8138ba5ab4e491e836b7fd88070 |
|
MD5 | de82e9dea87210e049c32feff6885b27 |
|
BLAKE2b-256 | 29330c42a908ea7d19284ebb686f4b269966c036dfa49ca6712bf08676c1096a |