Package: django-url-breadcrumbs
An app for generic breadcrumbs in Django (>= 1.4).The idea is to make breadcrumbs out of parts of an url path. This application assumes that your url patterns are well structured. For example like this:/                                               # root path
/application/                                   # root of an app/module
/application/object_type/                       # list of specific objects
/application/object_type/some_object/           # details of specific object
/application/object_type/some_object/edit/      # edit (or any other operations) of a specific objectInstallationInstall the package from PyPi. For example via pip:pip install django-url-breadcrumbsAddurlbreadcrumbsto INSTALLED_APPS:INSTALLED_APPS = (
    ...
    'urlbreadcrumbs',
    ...
)Make sure you have a request context processordjango.core.context_processors.requestin yourTEMPLATE_CONTEXT_PROCESSORS.UsageLet’s assume you have your urls in a form:inROOT_URLCONF:from django.conf.urls import patterns, include, url
from myproject.views import some_view

urlpatterns = patterns('',
    url(r'^$', some_view, {'template' : 'index.html'}, name='index'),
    url(r'^test1/', include('test1.urls')),
)urls.pyin application calledtest1:from django.conf.urls import patterns, include, url
from test1.views import some_view

urlpatterns = patterns('',
    url(r'^example/$', some_view, {'template' : 't1.html'}, name='t1home'),
)In order to define your breadcrumbs you can make a mapping insettings.pylike this:URLBREADCRUMBS_NAME_MAPPING = {
    'index'  : 'Home page',
    't1home' : 'Index page of Test1',
}Then somwhere in your base template (lets call itbase.html) you can write this:{% load urlbreadcrumbs_tags %}
{% render_breadcrumbs %}or you can specify your own template:{% render_breadcrumbs "test1/mybreadcrumbs_template.html" %}Also you can just include your breadcrumbs template:{% include "test1/mybreadcrumbs_template.html" %}But to use it like this make sure you’ve added a context procesorurlbreadcrumbs.context_processors.build_breadcrumbsin yourTEMPLATE_CONTEXT_PROCESSORSsetting.In your template you have one additional context variable calledbreadcrumbswhich is a list of two-tuples containing name and url of a breadcrumb.
The default template used bydjango-url-breadcrumbs(urlbreadcrumbs/default.html) looks like this:{% for n,u in breadcrumbs %}
    {% if not forloop.last %}
        <a href="{{ u }}">{{ n }}</a> &raquo;
    {% else %}
        {{ n }}
    {% endif %}
{% endfor %}So now, assuming templatet1.htmlis extendingbase.html, when viewing/test1/example/you should see something like thisHome page » Index page of Test1.Another way of specyfing a name for a breadcrumb is to use a customurlfunction in yoururls.py.
Instead of defining a mapping inURLBREADCRUMBS_NAME_MAPPINGsetting you can do this inurls.pyof yourROOT_URLCONFandtest1application:from django.conf.urls import patterns, include, url
from urlbreadcrumbs import url as burl

urlpatterns = patterns('',
    ...
    burl(r'^test1/', include(test1_urls)),
    ...
)andfrom django.conf.urls import patterns, include, url
from test1.views import some_view
from urlbreadcrumbs import url as burl

urlpatterns = patterns('',
    burl(r'^example/$', some_view, {'template' : 't1.html'}, name='t1home', verbose_name='Index page of Test1'),
)This should work as in previous example.DevelopmentIdeas and/or bug reports are welcome. Consider reporting an issue onhttps://bitbucket.org/slafs/django-url-breadcrumbs/issues?status=new&status=openPull requests are also welcome ;).To start working on this app get the source from Bitbucket:hg clone https://bitbucket.org/slafs/django-url-breadcrumbsand in a newly created virtualenv do this:pip install -r dev_requirements.txt
python setup.py testTestingdjango-url-breadcrumbs usespytestfor running it’s test suite andtoxfor checking it’s compatibilty
with different Python and Django versions.In order to perform tests with your current python and django installation do this:python setup.py testTo test it with different python and django versions run this:tox