Navbar
The navbar is assembled by AdminNavbarService. It always includes the built-in
theme item, then adds custom buttons, dropdowns from page groups, and the user
menu.
Built-in theme item
django_chassis.navbar.theme ships a theme switcher. You do not register it
yourself; the navbar service inserts it.
Custom buttons and user-menu items
Declare classes on the site:
from django_chassis.components import AdminNavbarButton, AdminUserMenuItem
class ReportsButton(AdminNavbarButton):
slug = 'reports'
label = 'Reports'
icon_class = 'fa-solid fa-chart-line'
def get_url(self, request):
return '/admin/pages/reports/'
class CustomAdminSite(ChassisAdminSiteMixin, AdminSite):
navbar_button_classes = (ReportsButton,)
user_menu_item_classes = ()
The users module adds Profile and Change password items unless
include_users_module = False. See Users and access.
Slugs must be unique. The service validates that before rendering.
Available contracts:
AdminNavbarButton— a single link in the navbarAdminNavbarDropdown— a parent with child itemsAdminUserMenuItem— an item in the authenticated user menuAdminNavbarItem— shared base
Page groups as dropdowns
An AdminPage with navbar_group = AdminPageGroupOption(...) is collected
into a navbar dropdown. Personal pages cannot join a group.
from django_chassis.options import AdminPageGroupOption
reports = AdminPageGroupOption(slug='reports', label='Reports', icon_class='fa-solid fa-chart-line', order=10)
| Parameter | Type | Default |
|---|---|---|
slug | str | required |
label | localized string | required |
icon_class | Font Awesome class | required |
order | int | 0 |
The same option type is reused as dashboard_group for dashboard action
sections. See Custom pages.
Page-group dropdowns share the global navbar order with custom buttons.
Dropdown child items with opens_modal=True render as modal triggers instead
of links. See Modal components.
Brand
Changed in 1.0.1The site defaults to the documentation icon (admin/chassis/icon.svg) for
the login brand and favicon. Override:
chassis_brand_namechassis_brand_logo_static_pathchassis_brand_favicon_static_path
Or override get_chassis_brand() / get_chassis_brand_badge() to return
BrandDTO / BrandBadgeDTO.
Complete logos preserve their natural aspect ratio. Set chassis_brand_name = None when the image includes the name. Use chassis_brand_favicon_static_path or BrandDTO.favicon_static_path for a separate square favicon; None falls back to the logo.