A pluggable Django app for adding breadcrumbs to your project.
Project description
django-crumbs
django-crumbs is a pluggable Django app for adding breadcrumbs to your project.
Installation
Install django-crumbs with pip:
pip install django-crumbs
Add to your INSTALLED_APPS and run syncdb:
INSTALLED_APPS = ( ..., 'crumbs', )
How It Works
In each template, you’ll need to use the add_crumb template tag to append items to the trail:
# basic crumb without a link {% add_crumb 'People' %} # crumb with link {% add_crumb 'People' 'list_people' %} # crumb with link and args {% add_crumb person.name 'view_person' person.pk %}
Note: no bread crumbs will be printed if only one call to add_crumb has been made.
Setup
In your base.html template, add something along the lines of the following code:
<div id="breadcrumbs"> {% block breadcrumb %} {% load breadcrumb_tags %} {% add_crumb 'Home' 'home' %} {% endblock %} {% render_breadcrumbs %} </div>
Now in each extended child template, simply add a new crumb to the trail in the breadcrumb block:
{% block breadcrumb %} {{ block.super }} {% load breadcrumb_tags %} {% add_crumb 'People' 'list_people' %} {% endblock %}
Example
base.html:
<div id="breadcrumbs"> {% block breadcrumb %} {% load breadcrumb_tags %} {% add_crumb 'Home' 'home' %} {% endblock %} {% render_breadcrumbs %} </div>
person/list.html:
{% extends "base.html" %} {% block breadcrumb %} {{ block.super }} {% load breadcrumb_tags %} {% add_crumb 'People' 'list_people' %} {% endblock %}
person/view.html:
{% extends "person/list.html" %} {% block breadcrumb %} {{ block.super }} {% load breadcrumb_tags %} {% add_crumb person.name 'view_person' person.pk %} {% endblock %}
Development sponsored by Caktus Consulting Group, LLC.
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.