Skip to main content

Navbar

Added in 1.0.1

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 navbar
  • AdminNavbarDropdown — a parent with child items
  • AdminUserMenuItem — an item in the authenticated user menu
  • AdminNavbarItem — 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)
ParameterTypeDefault
slugstrrequired
labellocalized stringrequired
icon_classFont Awesome classrequired
orderint0

The same option type is reused as dashboard_group for dashboard action sections. See Custom pages.

Changed in 1.0.7

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.1

The site defaults to the documentation icon (admin/chassis/icon.svg) for the login brand and favicon. Override:

  • chassis_brand_name
  • chassis_brand_logo_static_path
  • chassis_brand_favicon_static_path

Or override get_chassis_brand() / get_chassis_brand_badge() to return BrandDTO / BrandBadgeDTO.

Changed in 1.0.21 Added in 1.0.21

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.

See also​

Notifications​

Added in 1.0.23

With notifications enabled, the user menu and sidebar link to the current administrator’s inbox. The badge counts active unread items. See Administrator notifications for delivery, providers and acknowledgements.

System notification journal​

Added in 1.0.23

Add SidebarModelItemOption(model='django_chassis.globalalertjournal') to a sidebar section to link to the read-only journal. Grant django_chassis.view_globalalertjournal for access. The journal lists stored notifications, including closed ones, and applies each notification's audience and source permission. It supports search and filters. Providers can also deliver inbox notifications without storing them in the journal.

For project health checks, publish a notification with a stable key and resolve it with the same key once the check recovers.

from django_chassis.services.global_alert_service import GlobalAlertService

GlobalAlertService.publish(
key='dependency-cache',
message='The cache health check failed.',
is_active=True,
object_label='Cache',
permission='core.view_dependencyobservation',
)

Set is_active=False to close a previously published warning. GlobalAlertService.synchronize_geoip() uses this same lifecycle for the configured GeoIP database. On AdminSite, global_alert_excluded_slugs hides specified keys from the journal and inbox. Set global_alert_inbox_permission when the inbox requires a separate site-wide permission. Its default is None, so the inbox applies each notification's own audience and source permission.