API reference

Decorators

Usage:

from navigation.decorators import breadcrumb

@breadcrumb('greeting')
def some_view(request):
    return 'Hello world!'

@breadcrumb(lambda request: 'greeting for %s' % request.user.username)
def some_view(request):
    return 'Hello %s!' % request.user.username

Template tags and filters

Loading:

{% load navigation_tags %}

Resolves given named URL and returns the relevant breadcrumb label (if available). Usage:

<a href="{% url project-detail project.slug %}">
    {% named_crumb project-detail project.slug %}
</a>

Acts like named_crumb() but also wraps the result into a link tag. Usage:

<ul>
    <li>{% crumb_link 'auth_login' %}</li>
    <li>{% crumb_link 'project-index' %}</li>
</ul>

The result:

<ul>
    <li><a href="/accounts/login/">Log in</a></li>
    <li><a href="/projects/">Projects</a></li>
</ul>

Please note that you have to use quotes, otherwise the arguments are considered variable names.

Returns a list of sections. Usage:

{% get_breadcrumb_sections as sections %}
{% for section in sections %}
    ...
{% endfor %}

Returns the trail of breadcrumbs. Each breadcrumb is represented by a navigation.helpers.Crumb instance.

Returns the rendered navigation block. Requires that the navigation.html template exists. Two context variables are passed to it:

Helpers

A navigation node.

this breadcrumb’s URL.

this breadcrumb’s title, as determined by the first successful crumb resolver.

True if this breadcrumb’s URL corresponds to the current request path.

True if current request path begins with this breadcrumb’s URL.

True if this breadcrumb is a stub, i.e. its URL could not be resolved by a crumb resolver.

Table Of Contents

Previous topic

Django-Navigation

Next topic

Glossary

This Page