Skip to main content

Lucus enhances Django Admin with custom templates, static theming, and a multi-column dashboard.

Project description

Lucus (Django admin theme)

Русский

Admin skin: Lucus base.html, bundled CSS (lucus/css/style.css, lucus-admin.css), per-user palette + light/dark/auto (LucusAdminUiPreference), /admin/ dashboard config. Nav sidebar off; changelist actions + change-form save row pinned to viewport bottom.

Lucus Lucus Lucus

Requirements

  • Python 3.10+
  • Django >=5.2,<7 (see pyproject.toml)

Install

pip install django-lucus

Import: lucus. PyPI: django-lucus.

Setup

INSTALLED_APPS = [
    # ...
    "lucus",
    "django.contrib.admin",
]
python manage.py migrate lucus_admin

Production: collectstatic as usual.

Settings

Setting Type Default Effect
SITE_NAME str "Site" LUCUS_ADMIN_SITE_HEADER_TEMPLATE / site_title
LUCUS_ADMIN_SITE_HEADER_TEMPLATE str "Administration — {site}" admin.site.site_header = .format(site=SITE_NAME); use only {site} or escape other {}
LUCUS_ADMIN_SITE_TITLE_USE_SITE_NAME bool True admin.site.site_title = SITE_NAME if true
LUCUS_ADMIN_BACKGROUND_IMAGE str / Path "" Full-page background: http(s)://, //, site path /…, or static path (no ..)
LUCUS_ADMIN_BACKGROUND_SCRIM_OPACITY float 0.88 Theme overlay on image, 0.01.0
LUCUS_ADMIN_LANGUAGE_SELECTOR bool (auto) False → hide header language <select>. Shown only if USE_I18N, len(LANGUAGES) > 1, LocaleMiddleware, set_language URL exists
LUCUS_ADMIN_SITE_SELECTOR bool (auto) False → hide django.contrib.sites header switcher. Shown if sites app + ≥2 Site rows
LUCUS_UI dict {} See below
LUCUS_EXTRA_STATIC_CSS str / list / tuple () Extra CSS paths after palette; no .., no leading /
LUCUS_EMPTY_VALUE_DISPLAY_WRAP bool True Wrap empty changelist cells in lucus-admin-empty
LUCUS_EMPTY_VALUE_PLACEHOLDER str "—" empty_value_display text
LUCUS_ACTIONS_ON_BOTTOM bool True Set ModelAdmin.actions_on_bottom on the class
LUCUS_ACTIONS_ON_TOP bool True Set ModelAdmin.actions_on_top on the class
LUCUS_DASHBOARD list / None None Dashboard; None → built-in grouped layout
LUCUS_DASHBOARD_APPEND_UNCOVERED bool True Grouped mode: append uncovered apps to last column

Palette / appearance: not in settings. Stored per user in LucusAdminUiPreference. Slugs: olivia, grey, slate, dune, midnight, nord, dracula, github, catppuccin, tokyolucus/static/lucus/css/<slug>.css. Context: lucus.theme.lucus_admin_extra_contextadmin.site.each_context.

LUCUS_UI

Key Default Effect
help_as_icon True Field help_text behind a ? / <details>
high_contrast_toggle False User menu “High contrast” (localStorage + data-lucus-contrast on <html>)

Example:

LUCUS_UI = {
    "help_as_icon": True,
    "high_contrast_toggle": False,
}

LUCUS_DASHBOARD

Context: lucus_dashboard_columns from get_dashboard_for_request. Section link: {"label", "url"} or {"label", "admin_urlname"} (e.g. admin:app_model_changelist). Section omitted if no link resolves.

Layout mode: [{ "column"?: 1–4, "classes"?: str, "sections": [{ "title", "links": [...] }] }, …]. Same column → merge sections; classes from first dict.

Groups mode: [{ "column", "title", "links"?: [...], "app_labels"?: set|list|tuple|frozenset }, …]. links first, then models from app_labels; duplicate URLs dropped. list/tuple app_labels → order kept; setget_app_list order.

LUCUS_DASHBOARD_APPEND_UNCOVERED: True → apps not referenced by groups / inferred from admin_urlname go to last column; False → only configured groups.

LUCUS_DASHBOARD = [
    {
        "column": 1,
        "classes": "lucus-dashboard__col lucus-col lucus-col-3 lucus-col-md-6 lucus-col-sm-12",
        "sections": [
            {
                "title": "Education",
                "links": [
                    {"label": "Instructors", "admin_urlname": "admin:academy_instructor_changelist"},
                    {"label": "Courses", "url": "/admin/academy/course/"},
                ],
            },
        ],
    },
]
LUCUS_DASHBOARD = [
    {"column": 1, "title": "Authorization", "app_labels": {"auth"}},
]
LUCUS_DASHBOARD = [
    {
        "column": 2,
        "title": "Auth",
        "links": [{"label": "Users", "admin_urlname": "admin:auth_user_changelist"}],
        "app_labels": ("auth",),
    },
]

Static

Load order: lucus/css/style.csslucus/css/lucus-admin.csslucus/css/<slug>.cssLUCUS_EXTRA_STATIC_CSS. Admin widget JS still from django.contrib.admin.

Custom palette: add static/.../lucus/css/<slug>.css and extend lucus.theme.BUNDLED_COLOR_SCHEMES in your project.

Package

  • lucus.apps.LucusConfigready(): headers, each_context, dashboard, URLs lucus_save_ui / lucus_save_site, enable_nav_sidebar = False, empty value display, actions flags
  • lucus.dashboard — config → columns
  • lucus.modelsLucusAdminUiPreference
  • lucus.theme — schemes, lucus_admin_extra_context
  • lucus.views — POST save UI / site

Version: lucus.__version__.

Sites toolbar: for request.site in admin to follow the header switcher, add lucus.sites_panel.LucusAdminSiteMiddleware after SessionMiddleware (lucus.sites_panel).

Compatibility: Django 5.2+ (pyproject.toml).

Project details


Download files

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

Source Distribution

django_lucus-0.1.5.tar.gz (64.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_lucus-0.1.5-py3-none-any.whl (80.5 kB view details)

Uploaded Python 3

File details

Details for the file django_lucus-0.1.5.tar.gz.

File metadata

  • Download URL: django_lucus-0.1.5.tar.gz
  • Upload date:
  • Size: 64.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for django_lucus-0.1.5.tar.gz
Algorithm Hash digest
SHA256 488832e2e1321b5280714e8059fec730957b841052d1326df03749419dddba7b
MD5 b8368dac29de36ba1a3aff97350e5940
BLAKE2b-256 b1ef05c52d781653e8d6294c0e487e5be4890a02f8a8bb38da2d01a3fea3680c

See more details on using hashes here.

File details

Details for the file django_lucus-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: django_lucus-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 80.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for django_lucus-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d2ba2e49446b22b75592ef41b1d6d76a46d2d9f7261c49554b76508ade7f8718
MD5 f656f904e596a66be8ed44f41b30a47d
BLAKE2b-256 56c859fee86cf5e6ee37ff480f8a269d0947b6ce06b6012fb7b4d8db21b74ae5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page