Skip to main content

Information pages

Added in 1.0.1

AdminInformationPage is an AdminPage that renders structured sections, alerts, badges, header actions, and timelines. You still pick one access contract by subclassing PermissionAdminPage, PersonalAdminPage, or SuperuserAdminPage and AdminInformationPage (MRO: access contract first if both define has_view_permission).

Template: admin/chassis/information_page.html (extends admin/chassis/page.html).

Page anatomy

┌─ breadcrumbs ─────────────────────────────────────────────┐
│ Dashboard › Section › page label │
├─ header actions (`chassis_page_actions`) ─────────────────┤
│ AdminPageActionDTO buttons │
├─ alerts ──────────────────────────────────────────────────┤
│ AdminPageAlertDTO strip │
├─ CSS grid of sections (four columns) ─────────────────────┤
│ ┌ section title [header_action] ─────────────────────┐ │
│ │ row: icon label value badges [row action] │ │
│ │ … or a timeline instead of rows │ │
│ └────────────────────────────────────────────────────┘ │
└───────────────────────────────────────────────────────────┘

view() always calls:

self.render(
request=request,
information_sections=self.get_information_sections(request=request),
chassis_page_actions=self.get_page_actions(request=request),
chassis_page_alerts=self.get_page_alerts(request=request),
)

You implement get_information_sections. The other two hooks default to [].

Hooks

MethodReturnRequired
get_information_sections(request)list[AdminInformationSectionDTO]yes
get_page_actions(request)list[AdminPageActionDTO]no
get_page_alerts(request)list[AdminPageAlertDTO]no

DTOs

AdminInformationSectionDTO

A titled block on the four-column grid.

FieldTypeDefaultPurpose
titlelocalized stringrequiredSection heading
rowslist[AdminInformationRowDTO]requiredLabel/value rows
column_spanint4Width in columns (1–4)
column_startint or NoneNoneOptional grid start
row_spanint1Vertical span
timelineAdminTimelineDTO or NoneNoneReplaces rows when set
header_actionAdminPageActionDTO or NoneNoneButton on the section header

AdminInformationRowDTO

FieldTypeDefault
labellocalized stringrequired
valueany or Nonerequired
actionAdminPageActionDTO or NoneNone
badgestuple[AdminInformationBadgeDTO, ...]()
icon_classFont Awesome class''
icon_colorButtonColor or NoneNone
icon_labellocalized string''

AdminInformationBadgeDTO

FieldType
labellocalized string
colorButtonColor

AdminPageAlertDTO

FieldTypeDefault
messagelocalized stringrequired
colorButtonColorrequired
icon_classFont Awesome class''

AdminPageActionDTO

Used in the page toolbar, section headers, and rows.

FieldTypeDefault
labellocalized stringrequired
urlstrrequired
colorButtonColorrequired
icon_classFont Awesome class''
show_labelboolFalse

Timeline family

DTOFields
AdminTimelineDTOgroups: list[AdminTimelineGroupDTO], empty_text
AdminTimelineGroupDTOdate_label, items: list[AdminTimelineItemDTO]
AdminTimelineItemDTOoccurred_at: datetime, title, subtitle, result_color: ButtonColor | None

Typical page

from django_chassis.dto import (
AdminInformationBadgeDTO,
AdminInformationRowDTO,
AdminInformationSectionDTO,
AdminPageActionDTO,
AdminPageAlertDTO,
)
from django_chassis.enums import ButtonColor
from django_chassis.views import AdminInformationPage, PermissionAdminPage


class InventoryPage(PermissionAdminPage, AdminInformationPage):
slug = 'inventory'
title = 'Inventory'
label = 'Inventory'
permission = view_inventory

def get_page_alerts(self, request):
return [
AdminPageAlertDTO(
message='Two imports are waiting for review.',
color=ButtonColor.WARNING,
icon_class='fa-solid fa-triangle-exclamation',
)
]

def get_page_actions(self, request):
return [
AdminPageActionDTO(
label='Open books',
url='/admin/catalog/book/',
color=ButtonColor.PRIMARY,
icon_class='fa-solid fa-book',
show_label=True,
)
]

def get_information_sections(self, request):
return [
AdminInformationSectionDTO(
title='Overview',
column_span=2,
rows=[
AdminInformationRowDTO(
label='Books',
value='128',
badges=(AdminInformationBadgeDTO(label='live', color=ButtonColor.SUCCESS),),
),
AdminInformationRowDTO(label='Authors', value='34'),
],
)
]

TableOption can sit next to sections when you need a tabular block on a custom view(). Related-entity tables on a ModelAdmin change form are a different option — see Related entities.

See also