Skip to main content

Breadcrumbs support on django class based views

Project description

To enable django-views-breadcrumbs you need add views_breadcrumbs to INSTALLED_APPS:

INSTALLED_APPS += ('views_breadcrumbs',)

To add breadcrumb to view, use breadcrumb decorator:

from views_breadcrumbs.views import breadcrumb
class IndexView(View):

@breadcrumb(lambda args, kwargs, context, request: context['category'].name, parent='project.views.index')
class ProductListView(ListView):

where project.views.index is view name of parent view.

If you want to pass object (first) function parameters to parent, you should use parent_args. When you pass parent_args, parent view will be not dispatched:

@breadcrumb(lambda args, kwargs, context, request: context['product'].name,
            parent_args=lambda args, kwargs, context, request: [], {}, {'category': context['product'].category}
class ProductDetailView(DetailView):

parent_args must return list of args, kwargs and context, witch will pass to parent breadcrumb object parameter


Set BREADCRUMBS_TEMPLATE_CONTEXT_NAME to change context name (default is breadcrumbs):



If you want to get warnings when middle view of breadcrumbs branch is dispatched (it means dispatched not only current view, but also parent), you can use BreadcrumbsWarningMiddleware:

MIDDLEWARE_CLASSES += ('views_breadcrumbs.middleware.BreadcrumbsWarningMiddleware', )

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-views-breadcrumbs, version 0.1.dev3
Filename, size File type Python version Upload date Hashes
Filename, size django-views-breadcrumbs-0.1.dev3.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page