Admin site
ChassisAdminSiteMixin attaches Chassis capabilities to a Django AdminSite. The
application that owns the site instance declares brand, navigation, pages, and
dashboard layout.
Minimal site
from django.contrib.admin import AdminSite
from django.utils.translation import gettext_lazy as _
from django_chassis.mixins import ChassisAdminSiteMixin
class CustomAdminSite(ChassisAdminSiteMixin, AdminSite):
chassis_brand_name = _('My project')
chassis_brand_logo_static_path = 'img/logo.png'
admin_site = CustomAdminSite(name='admin')
Mount admin_site.urls, not admin.site.urls.
Site-level option field tables (Sidebar*, AdminPageGroupOption,
PermissionOption): Options catalog.
Site attributes
| Attribute | Purpose |
|---|---|
chassis_brand_name | Brand title in the shell |
chassis_brand_logo_static_path | Static path to the logo; preserves its natural aspect ratio. Defaults to admin/chassis/icon.svg |
chassis_brand_favicon_static_path | Separate favicon; None falls back to the logo |
sidebar_items | SidebarLinkOption / SidebarSectionOption tuple |
chassis_page_classes | Custom AdminPage subclasses |
chassis_permission_options | Extra PermissionOption declarations |
dashboard_component_classes | Dashboard component classes |
dashboard_blocks | DashboardBlockDTO layout |
dashboard_show_toolbar | Set to True for dashboard pause and manual refresh controls. Defaults to False Added in 1.0.23 |
navbar_button_classes | Extra navbar buttons |
user_menu_item_classes | Extra user-menu items |
chassis_modal_classes | Reusable AdminModal component classes |
show_recent_actions | Show Django recent actions on the index |
include_users_module | Register Users/Groups, sessions, login attempts, audit, profile pages |
include_users_sidebar | Add the standard Users and Administrators sections |
include_global_alerts | Enable the built-in notification inbox and admin models. Omit to follow the users module Added in 1.0.23 |
global_alert_providers | Additional notification providers Added in 1.0.23 |
global_alert_inbox_permission | Optional permission to see and acknowledge inbox items Added in 1.0.23 |
global_alert_excluded_slugs | Slugs to exclude from the inbox and system journal on this site Added in 1.0.23 |
Declare user_menu_item_classes, chassis_modal_classes, and
chassis_permission_options as ordered sequences, such as lists or tuples.
CHASSIS_USERS_MODULE_ENABLED = False globally disables the built-in users
runtime even when include_users_module remains True on a site.
Complete logos
Changed in 1.0.21 Added in 1.0.21Use a complete logo containing the project name and disable the separate text caption. Images preserve their aspect ratio at 22px height in the sidebar and 30px on login. The optional chassis_brand_favicon_static_path selects a separate square icon; omitting it preserves the existing logo-as-favicon behavior.
chassis_brand_name = None
chassis_brand_logo_static_path = 'img/full-logo.svg'
chassis_brand_favicon_static_path = 'img/favicon.svg'
Service hooks
Override these when you need a custom service implementation:
get_dashboard_service()get_navbar_service()get_chassis_modal_service()get_chassis_page_service()get_sidebar_service()get_chassis_brand()/get_chassis_brand_badge()get_chassis_footer_context()get_global_alert_service()supplies this site's notification providers, exclusions and inbox access rule Added in 1.0.23get_login_provider_buttons(request)returns a tuple ofLoginProviderButtonDTOobjects for external sign-in buttons Added in 1.0.23
The mixin also attaches the users module unless
include_users_module = False.
Admin footer
Added in 1.0.23Set CHASSIS_FOOTER in Django settings to fill the shared footer on admin
pages. Each field is optional.
CHASSIS_FOOTER = {
'company_developer': 'Example Studio',
'company_developer_url': 'https://example.com/',
'version': 'v2.4.0'
}
The developer credit uses the current local year if period is omitted.
Set period to an empty string to omit the year. Set product_name to add
a label and instance_id to show a tooltip when version is present.
The footer displays the version as supplied. Override the
get_chassis_footer_context() class method for site-specific values.
When these entries are omitted, Chassis can fill them from the installation and confirmed release for users with the corresponding view permissions.
Third-party ModelAdmins
Changed in 1.0.2The site wraps ordinary third-party ModelAdmin classes in ChassisAdminMixin so
they pick up Chassis templates and default row actions. You still register
those models on the Chassis site instance.
The register() signature uses the broad Django Model type so applications
can override it without narrowing-override warnings from type checkers.
ChassisAdminSiteMixin remains a pure runtime mixin; the project's AdminSite
is the next class in the MRO and receives delegated Django calls.
Index template
index_template defaults to admin/chassis/dashboard/index.html. If you
declare no dashboard components, the page still renders the Chassis shell.
Validation at construction
The mixin constructor:
- registers every
PermissionOptionfromchassis_permission_options - requires each page class to declare exactly one access contract
(
PermissionAdminPage,PersonalAdminPage, orSuperuserAdminPage) - rejects
PersonalAdminPageclasses that join navbar or dashboard groups - requires
PermissionAdminPage.permissionto be aview_*permission - validates modal classes and registers permissions declared by
PermissionAdminModal
Failures raise ImproperlyConfigured at site construction, not on the first
request.