Skip to main content

django-crumbs

django-crumbs is a pluggable Django app for adding breadcrumbs to your project.

Installation

  1. Install django-crumbs with pip:

    pip install django-crumbs
  2. Add to your INSTALLED_APPS and run syncdb:

    INSTALLED_APPS = (
        ...,
        'crumbs',
    )

How It Works

  1. 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

  1. 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>
  2. 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

  1. base.html:

    <div id="breadcrumbs">
        {% block breadcrumb %}
            {% load breadcrumb_tags %}
            {% add_crumb 'Home' 'home' %}
        {% endblock %}
        {% render_breadcrumbs %}
    </div>
  2. person/list.html:

    {% extends "base.html" %}
    {% block breadcrumb %}
        {{ block.super }}
        {% load breadcrumb_tags %}
        {% add_crumb 'People' 'list_people' %}
    {% endblock %}
  3. 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.

Download files

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

Source Distribution

django-crumbs-0.5.0.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file django-crumbs-0.5.0.tar.gz.

File metadata

  • Download URL: django-crumbs-0.5.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-crumbs-0.5.0.tar.gz
Algorithm Hash digest
SHA256 61cfa5bb8791fd83cff7158c0740ea1d6ab3ee6046c3118c187368e3b4b51208
MD5 1a23dca98deb189eb21ad1c66c5ca2e0
BLAKE2b-256 16ff0f06da398b968c60d52f90905e8da5c9cc873645bdf62828367daaa6fb2e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page