Skip to main content

django-simple-nav

PyPI PyPI - Python Version Django Version

Define your navigation in Python, render it in templates. django-simple-nav handles URL resolution, active state detection, and permission filtering so your nav stays in sync with your project.

Requirements

  • Python 3.10, 3.11, 3.12, 3.13, 3.14
  • Django 5.2, 6.0, 6.1

Installation

uv add django-simple-nav
# or
python -m pip install django-simple-nav

Add django_simple_nav to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...,
    "django_simple_nav",
    # ...,
]

Getting Started

Define your navigation in a Python file. items is what gets rendered, and template_name points to the template that controls the markup:

# config/nav.py
from django_simple_nav.nav import Nav
from django_simple_nav.nav import NavGroup
from django_simple_nav.nav import NavItem


class MainNav(Nav):
    template_name = "main_nav.html"
    items = [
        NavItem(title="Home", url="/"),
        NavItem(title="About", url="/about/"),
        NavGroup(
            title="Resources",
            items=[
                NavItem(title="Blog", url="/blog/"),
                NavItem(title="Contact", url="/contact/"),
            ],
        ),
    ]

Create main_nav.html. The template receives the items defined above — each has a title, url, active state, and groups have nested items:

<!-- main_nav.html -->
<nav>
  <ul>
    {% for item in items %}
      <li>
        <a href="{{ item.url }}"{% if item.active %} class="active"{% endif %}>
          {{ item.title }}
        </a>
        {% if item.items %}
          <ul>
            {% for subitem in item.items %}
              <li>
                <a href="{{ subitem.url }}"{% if subitem.active %} class="active"{% endif %}>
                  {{ subitem.title }}
                </a>
              </li>
            {% endfor %}
          </ul>
        {% endif %}
      </li>
    {% endfor %}
  </ul>
</nav>

Then use the template tag wherever you want the nav to appear. The string is the import path to your Nav class:

{% load django_simple_nav %}

{% django_simple_nav "config.nav.MainNav" %}

Examples

The example directory contains a simple Django project that demonstrates how to use django-simple-nav, including navigation definitions for a few different scenarios and some popular CSS frameworks.

git clone https://github.com/joshuadavidthomas/django-simple-nav
cd django-simple-nav
uv sync
uv run example/demo.py runserver

Then open your browser to http://localhost:8000.

Documentation

For the full documentation — including permissions, extra context, Jinja2 support, self-rendering items, and more — please visit the documentation site.

License

django-simple-nav is licensed under the MIT license. See the LICENSE file for more information.

Metadata

Release files for django-simple-nav 0.16.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-simple-nav 0.16.0
File Size Uploaded Provenance
django_simple_nav-0.16.0.tar.gz 10.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-simple-nav 0.16.0
File Interpreter ABI Platform
django_simple_nav-0.16.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / django_simple_nav-0.16.0.tar.gz

Download URL django_simple_nav-0.16.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b271cdad9ba411b6e01655a1ea3753c583af710f5e43739b16ad88de7c049f36
BLAKE2b-256 checksum
How to use checksums
253fc434cb591efce545c2038132ba492577201b4174dc0d05a37cc74f41d019
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / django_simple_nav-0.16.0-py3-none-any.whl

Download URL django_simple_nav-0.16.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
419f4eaf9f97dcf759628405155a05cb116efe344f2145b99a6cc9773b598b26
BLAKE2b-256 checksum
How to use checksums
a6e9d04d93a13064d9ade5203195b7abcd4819a2fa1c519852dc64a3dc3143fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Security for django-simple-nav 0.16.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_simple_nav-0.16.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

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.

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