Skip to main content

django-admin-home

Latest on Django Packages

A tree-navigation sidebar, home dashboard and header user menu for the Django admin.

By default, the Django admin's home page is a flat, alphabetical list of every app/model the current user can access, and the built-in sidebar has no favorites or usage-based shortcuts. This package replaces both with:

Features

  • A collapsible sidebar, grouped by app, built from the admin's own get_app_list — so it always respects the current user's permissions.
  • A "Favorites" section and a star to pin/unpin any app or model (persisted per user).
  • A home page with cards for favorites, most-accessed items (tracked per user), and every module, in a responsive grid (with an optional compact "masonry" layout).
  • An optional "Pages" group for custom, non-model links (dashboards, API docs, external tools, ...), entirely configured via settings.
  • A header user menu: identity, a language switcher (driven by settings.LANGUAGES), an explicit Auto/Light/Dark theme switcher, and account shortcuts (change password, log out).
  • A dependency-free, offline SVG icon set (no external font/CDN).
  • Defensive by design: any unexpected failure falls back to the native admin behaviour instead of breaking the page.

Installation

pip install django-admin-home

Add it to INSTALLED_APPS (it ships models, so run migrate afterwards):

INSTALLED_APPS = [
    "django_admin_home",
    ...
    "django.contrib.admin",
]

Enable it, once — e.g. in your own app's AppConfig.ready():

from django.apps import AppConfig


class MyAppConfig(AppConfig):
    def ready(self):
        from django_admin_home import install

        install()

Include the bundled CSS/JS in your admin/base_site.html:

{% load static %}
<link rel="stylesheet" href="{% static 'django_admin_home/css/nav.css' %}">
<link rel="stylesheet" href="{% static 'django_admin_home/css/home.css' %}">
<link rel="stylesheet" href="{% static 'django_admin_home/css/user_menu.css' %}">
<script src="{% static 'django_admin_home/js/nav.js' %}" defer></script>
<script src="{% static 'django_admin_home/js/user_menu.js' %}" defer></script>

Run migrations:

python manage.py migrate django_admin_home

Header user menu (optional)

The user menu (identity, language switcher, theme switcher, account shortcuts) needs two context processors and a template include:

TEMPLATES = [{
    ...,
    "OPTIONS": {"context_processors": [
        "django.template.context_processors.request",
        "django.contrib.auth.context_processors.auth",
        ...,
        "django_admin_home.context_processors.admin_user",
        "django_admin_home.context_processors.admin_languages",
    ]},
}]
{% block usertools %}
    {% if has_permission %}
        <div id="user-tools">{% include "admin_home/_user_menu.html" %}</div>
    {% endif %}
{% endblock %}

The language switcher lists whatever is in settings.LANGUAGES and posts to Django's own set_language view — make sure django.middleware.locale.LocaleMiddleware and django.contrib.admin's i18n URLs are enabled. The theme switcher reuses the Django admin's own localStorage.theme + data-theme contract, so it stays in sync with the native toggle (which this menu hides, in favour of the explicit picker).

To add project-specific links to the menu (e.g. an internal tool), override the template admin_home/_user_menu_extra_actions.html (empty by default).

Settings (all optional)

# Icon per app/model. Value is a symbol name from the bundled SVG sprite
# (admin_home/_icon_sprite.html) — add your own <symbol> there via a
# template override if you need more icons.
ADMIN_HOME_APP_ICONS = {"buyers": "building", "cards": "card"}
ADMIN_HOME_MODEL_ICONS = {"buyers.buyer": "building"}

# Extra, non-model links shown in a "Pages" group.
ADMIN_HOME_CUSTOM_PAGES = [
    {
        "key": "page.dashboard",
        "name": "Dashboard",
        "icon": "gauge",
        "url_name": "dashboard_index",
        "permission": "account.view_menu_dashboard",  # optional
        "new_tab": True,
    },
]

# How many "most accessed" cards to show on the home page (default 8).
ADMIN_HOME_MAX_MOST_ACCESSED = 8

# Native label / sprite icon per language code, for the user menu's
# language switcher. A language missing here still works, with Django's
# own label and the bundled "globe" icon. The package ships no flag
# icons — any name in ADMIN_HOME_LANGUAGE_FLAGS must exist in the sprite,
# which means adding your own <symbol> via a template override of
# admin_home/_icon_sprite.html (see "Overriding the brand/logo" below).
ADMIN_HOME_LANGUAGE_LABELS = {"pt-br": "Português (BR)", "es": "Español"}
ADMIN_HOME_LANGUAGE_FLAGS = {"pt-br": "flag-br", "es": "flag-es"}

The sidebar header includes admin_home/_brand.html, which by default just shows site_header as text. To show your own logo, place a template at the same path earlier in your project's template resolution (e.g. templates/admin_home/_brand.html in your project, with APP_DIRS search order putting your project templates before installed apps).

What this package intentionally does not do

  • It does not set site_header / site_title / index_title — that stays a project-level decision.
  • It does not touch AdminSite.has_permission — any extra access rules are the host project's responsibility.
  • It does not migrate data from a previous, project-specific favorites/access-tracking implementation.
  • It does not ship any country flag icons, or a Rosetta/translation-tool link — both are left to the host project via settings/template overrides (see above).

Download files

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

Source Distribution

django_admin_home-0.2.3.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_home-0.2.3-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_home-0.2.3.tar.gz.

File metadata

  • Download URL: django_admin_home-0.2.3.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for django_admin_home-0.2.3.tar.gz
Algorithm Hash digest
SHA256 c8a2789f8f425d844a632402a98bfbda7c72bea543df9e9b10ba7e9f970f81f4
MD5 fce689860e78cb3bbd4d57803a6d48a8
BLAKE2b-256 06fe63cd93d525c562bedfe38fe2c24db0904872cd30a34cae51d634e5c5be85

See more details on using hashes here.

File details

Details for the file django_admin_home-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_home-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dbbd21a2d6ba4811796373f9a5130a649f9229468f12e15d07615acefb1f0347
MD5 6e55567623d8b22de15a2b29c74f543c
BLAKE2b-256 c6672d1ee63a139f2ec00faa521d5fb4fcb3e301e7073f4f64f9e1498431adca

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

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