after¶
Ordering of fields and columns is based on the declared order, the order in the model (when using auto), and the after configuration. The last takes precedence over the others.
To order fields, set after to:
field_nameto place after the named field>field_nameto place after the named field<field_nameto place before the named fieldan integer index
the special value
LASTto put a field last
Using after is especially useful when you already have a complex object that you want to add one or a few fields to in some specific position.
form = Form(
auto__model=Album,
fields__name__after=LAST,
fields__year__after='artist',
fields__artist__after=0,
)
▼ Hide result
Toggle structure
This will make the field order artist, year, name.
If there are multiple fields with the same index or name the order of the fields will be used to disambiguate.