Skip to main content

Changelist

Added in 1.0.1

The changelist is the ModelAdmin list page. Chassis keeps Django's result table and bulk actions, then rebuilds the chrome around them: breadcrumbs, toolbar, tabs, search, date hierarchy, and filters all sit in Chassis fieldsets.

admin/chassis/change_list.html extends Django's admin/change_list.html and defines the content structure shared by Django 6.0 and 6.1. Tabs, search, date hierarchy, and filters render before the results form. Bulk actions, the result table, and pagination render inside that form.

Every field below is documented in the Options catalog. This page explains how the page is assembled.

Page anatomy​

The bulk action selector uses a responsive 25em width.

┌─ breadcrumbs ─────────────────────────────────────────────┐
│ Dashboard › Sidebar section › Model verbose name │
├─ toolbar (`page_actions` / `object-tools`) ───────────────┤
│ [list actions…] [Import] [Export] [+ Add] │
├─ controls stack (`chassis-changelist-controls`) ──────────┤
│ Tabs fieldset FieldTabs / ForeignKeyTabs │
│ Search fieldset SearchOption │
│ Dates fieldset DateHierarchyOption │
│ Filters fieldset FiltersOption │
├─ results fieldset ────────────────────────────────────────┤
│ Django bulk actions (top) │
│ Result table: list_display + last-column row actions │
│ Django bulk actions (bottom) │
│ Total count Items per page · Pages │
└───────────────────────────────────────────────────────────┘
RegionDriven byNotes
BreadcrumbsAdminSidebarServiceSection label only if the model is in sidebar_items
List actionsListActionsOptionNamed URLs; may render disabled
Import / ExportImportOption / ExportOptionInjected as list actions
Addhas_add_permission + Settings.allow_standard_addHidden when either is false
Choice tabsFieldTabsOptionOne row of buttons or a select
FK tabsForeignKeyTabsOptionOne group per ForeignKeyTabGroupOption
SearchSearchOptionCollapsed via Settings.search_collapsed
DatesDateHierarchyOptionCollapsed via Settings.date_hierarchy_collapsed
FiltersFiltersOptionCollapsed via Settings.filters_collapsed
Table columnsDjango list_displayBadge / decimal / JSON fields are rewritten
Last columnRowActionsOptionOpen and delete according to permissions. Quick view is optional.

Open a record from its row actions. Chassis renders data cells without Django’s automatic change links. Boolean cells show a green check for true and a red cross for false.

How options are applied​

On ChassisAdminMixin.__init__:

  1. SearchOption.fields is written to instance search_fields.
  2. DateHierarchyOption.field is written to instance date_hierarchy.
  3. Badge, pretty-JSON, and decimal display methods are generated.
  4. List-action condition_method names are validated as @classmethod.

On changelist_view:

  1. Tabs and FK tab groups become context (tabs, tab_groups, field_tab_display).
  2. Search / filters / date hierarchy titles and collapsed flags go into context.
  3. _get_chassis_list_actions merges ListActionsOption with import/export buttons.

Query-string parameters of tabs, search, and filters are preserved when you follow Add or a row action.

from django_chassis.options import SearchOption

SearchOption(fields=['title', 'isbn'], fieldset_title='Search', placeholder='Title or ISBN')
ParameterTypeDefault
fieldslist[str]required — becomes search_fields
fieldset_titlelocalized stringSearch / Поиск
placeholderlocalized string''

Lookups are Django's: default icontains, ^ prefix, = exact, @ full text.

Filters​

from django_chassis.options import FiltersOption

FiltersOption(fields=['status', 'author'], fieldset_title='Filters')

fields accepts the same values as Django list_filter (field names, related lookups, SimpleListFilter subclasses). The stock right-hand filter sidebar is not used.

Date hierarchy​

from django_chassis.options import DateHierarchyOption

DateHierarchyOption(field='published_at')
ParameterTypeDefault
fieldmodel date/datetime fieldrequired
fieldset_titlelocalized stringDates / Даты

Field tabs​

Choice-based tabs (or a select) that filter the changelist.

For a standalone tab bar above page content, add chassis-field-tabs--page alongside chassis-field-tabs to leave a 1rem gap below it.

from django_chassis.enums import TabDisplay
from django_chassis.options import FieldTabsOption

FieldTabsOption(field='status', choices=Book.Status.choices, display=TabDisplay.BUTTONS, all_label='All')
ParameterTypeDefault
fieldmodel field namerequired
choiceslist of (value, label)required
displayTabDisplay.BUTTONS or SELECTBUTTONS
all_labellocalized stringAll / Все
fieldset_titlelocalized stringTabs

Each tab is a GET link. "All" drops the query parameter.

Foreign-key tabs​

Changed in 1.0.9

One or more FK-based tab groups. Attach one ForeignKeyTabsOption and put every group in groups.

from django_chassis.options import ForeignKeyTabGroupOption, ForeignKeyTabsOption

ForeignKeyTabsOption(groups=[ForeignKeyTabGroupOption(field='author', model=Author, label='Authors')])

ForeignKeyTabsOption also accepts a single-group shortcut via field and model instead of groups. Both forms accept queryset_filters, which is passed to the related model manager and limits the objects shown as tabs. Full field tables: Options catalog.

Collapsed fieldsets​

Settings.search_collapsed, filters_collapsed, and date_hierarchy_collapsed control the initial state. See ModelAdmin and Options catalog.

See also​

Preferred page size​

Changed in 1.0.23

The footer places the total result count on the left. On the right, Items per page comes before Django’s page links, with a gap between page buttons. Choose 25, 50, 75 or 100 to apply the size immediately. Chassis stores the choice in the current user's profile and returns to the first page with the current search and filters. Set CHASSIS_LIST_PAGE_SIZES to change the options and CHASSIS_LIST_PAGE_SIZE for the site default, which otherwise comes from the first option. Before the user makes a choice, a ModelAdmin's custom list_per_page takes precedence. An empty options list hides the selector and restores Django's page size. Related tables use their own component page_size.