Django generic view breadcrumbs
Project description
This extends django-bootstrap-breadcrumbs providing generic breadcrumb mixin classes.
This will replace having to add {% breadcrumb $label $viewname [*args] [**kwargs] %} to every template.
Installation:
$ pip install django-view-breadcrumbs
Add app to your INSTALLED_APPS
INSTALLED_APPS = [
...
'view-breadcrumbs',
...
]
Usage:
django-view-breadcrumbs includes generic mixins that can be added to a class based view.
Using the generic breadcrumb mixin each breadcrumb will added for each view dynamically using the view model class and can be overridden by providing a crumbs property.
Sample crumbs: Home \ Posts \ Test - Post
from django.views.generic import DetailView
from django_view_breadcrumbs import DetailBreadcrumbMixin
class PostDetail(DetailBreadcrumbMixin, DetailView):
model = Post
template_name = 'app/post/detail.html'
In your base.html template simply add the render_breadcrumbs tag and any template that inherits the base should have breadcrumbs included.
{% load django_bootstrap_breadcrumbs %}
{% block breadcrumbs %}
{% render_breadcrumbs %}
{% endblock %}
All crumbs use the home root path \ as the base this can be excluded by specifying add_home = False
Sample crumbs: Posts
from django.views.generic import ListView
from django_view_breadcrumbs import ListBreadcrumbMixin
class PostList(ListBreadcrumbMixin, ListView):
model = Post
template_name = 'app/post/list.html'
add_home = False
Can also override the view breadcrumb by specifying a list of tuples [(Label, view path)].
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
Hashes for django-view-breadcrumbs-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 336b2cf63a93e43a24128765b2b7e0d3c9ca03f54286ff9a3de801b9fb829117 |
|
MD5 | 25eff0bfeb074a94056644e261996a8c |
|
BLAKE2b-256 | 9c27bd833f74e54495023eb74aa18311a7dde546a1af613a08f035953e92bcfa |
Hashes for django_view_breadcrumbs-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaa51f937f06042f68218478bc67ccbdbc40fb69924e122daf87a074d434c332 |
|
MD5 | c36df0ef9556bc84d8f4829068c973cd |
|
BLAKE2b-256 | d8952e9786ea913970dd4bb8f8b3730994b92d2aef26ef04905c04e7da8b0cb3 |