Presentation
These options change how fields look on changelist and change form. They do
not add routes. The mixin generates display methods at __init__ and
rewrites matching names in list_display.
Full field tables: Options catalog.
Badge fields
from django_chassis.enums import ButtonColor
from django_chassis.options import BadgeFieldsOption
BadgeFieldsOption(fields=['status'], colors={'status': {'active': ButtonColor.SUCCESS, 'draft': ButtonColor.SECONDARY}})
| Parameter | Type | Default |
|---|---|---|
fields | field names to badge | required |
colors | field → value → ButtonColor | empty mapping |
Pretty JSON
Replaces configured JSON fields with syntax-highlighted read-only output (Pygments).
from django_chassis.options import PrettyJsonOption
PrettyJsonOption(fields=['payload'])
Decimal amounts
Displays integer minor-unit fields using two methods on the model:
_get_fraction_number and convert_amount_to_decimal. If either is
missing, the option is ignored. Listed names must be IntegerField or
construction raises ImproperlyConfigured. Duplicate names raise
ValueError. Use this when money is stored as an integer.
from django_chassis.options import DecimalAmountOption
DecimalAmountOption(fields=['amount'])
Date and time widgets
ChassisAdminMixin installs masked widgets for date, time, and datetime fields:
DateInputTimeInputDateTimeInput/SplitDateTime
No option is required. The widgets ship with the mixin.