Skip to main content

Perfect Breadcrumbs

Breadcrumbs for perfectionists with deadlines.

About

This package provides an easy way to add breadcrumbs to your Django project.

Usage

  1. Install the package with pip or poetry like so:
poetry add django_perfect_breadcrumbs
  1. Add the middleware to in your settings.py:
MIDDLEWARE = [
    ...
    "django_perfect_breadcrumbs.middleware.BreadcrumbsMiddleware",
]
  1. Add the context processor in your settings.py:
TEMPLATES = [
    {
        ...
    "OPTIONS": {
    "context_processors": [
        ...
        "django_perfect_breadcrumbs.context_processors.breadcrumbs",
    ],
},
},
]

You will now have access to breadcrumb_builder and breadcrumbs in view request objects.

Your templates will also contain the breadcrumbs variables.

Builder

Use the builder to add your breadcrumbs:

def home(request):
    return render(request, "testapp/index.html")


def about(request):
    request.breadcrumb_builder.add("Home", reverse_lazy("home"))
    request.breadcrumb_builder.add("About", active=True)
    return render(request, "testapp/about.html")


def about_josh(request):
    breadcrumbs = [
        {"name": "Home", "url": reverse_lazy("home")},
        {"name": "about", "url": reverse_lazy("about")},
        {"name": "About Josh", "active": True},
    ]
    request.breadcrumb_builder.add_bulk(breadcrumbs)
    return render(request, "testapp/josh.html")

Then use breadcrumbs in your templates:

<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    {% if breadcrumb.active %}
    <li class="breadcrumb-item active"
        aria-current="page">{{ breadcrumb.name }}
    </li>
    {% else %}
    <li class="breadcrumb-item"><a
        href="{{ breadcrumb.url }}">{{ breadcrumb.name }}</a></li>
    {% endif %}
    {% endfor %}
  </ol>
</nav>

License

MIT

Metadata

Release files for django-perfect-breadcrumbs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-perfect-breadcrumbs 0.1.0
File Size Uploaded Provenance Actions
django_perfect_breadcrumbs-0.1.0.tar.gz 3.3 kB Without provenance Details for django_perfect_breadcrumbs-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-perfect-breadcrumbs 0.1.0
File Interpreter ABI Platform Actions
django_perfect_breadcrumbs-0.1.0-py3-none-any.whl Python 3 none any Details for django_perfect_breadcrumbs-0.1.0-py3-none-any.whl

Total release size: 8.2 kB

Release files / django_perfect_breadcrumbs-0.1.0.tar.gz

Download URL django_perfect_breadcrumbs-0.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8ad59a04f4aae2196d5c203073f08990044f96fa62862a12a818f1f134e0ad4e
BLAKE2b-256 checksum
How to use checksums
0f1267a0ca070ede95b01144122074e28cc7ada11deedb0d015e11d4518e049d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-78-generic

Release files / django_perfect_breadcrumbs-0.1.0-py3-none-any.whl

Download URL django_perfect_breadcrumbs-0.1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
736fadc0168a251d4c2f341f8ccfdb0b1704461fc6e405fc513f0991501a95bd
BLAKE2b-256 checksum
How to use checksums
b5e5728b153c4545e384cd05db8db0585ca46a426a0aa9f70b3012be7b301043
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-78-generic

Security for django-perfect-breadcrumbs 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page