MiniJinja Context Variables

Each template receives a context object serialized as a MiniJinja value. The variables available depend on which template is being rendered.

Common Variables (List and Form Pages)

These variables are present in both list.html and form.html:

VariableTypeDescription
admin_titlestringThe title set via .title("My Admin")
admin_iconstringFont Awesome class for the sidebar logo icon
entitiesarrayFlat list of all registered entities (see EntityRef below)
navarraySidebar navigation items (see below)
current_entitystringName of the currently active entity
entity_namestringURL slug of the current entity
entity_labelstringHuman-readable name of the current entity
flash_successstring or nullSuccess flash message
flash_errorstring or nullError flash message
show_auth_navboolWhether to show Users / Roles links in the sidebar

The nav array contains items of two types, distinguished by a type field:

Entity link (type == "entity"):

FieldTypeDescription
namestringEntity URL slug
labelstringDisplay label
iconstringFont Awesome class
groupstring or nullGroup name if grouped

Group (type == "group"):

FieldTypeDescription
labelstringGroup display label
entitiesarrayChild entity links (same shape as entity type)
activeboolTrue if any child is currently active

EntityRef (entities[n])

The entities array (available on all list and form pages) is a flat list of every registered entity, useful for building custom navigation or cross-entity links.

FieldTypeDescription
namestringEntity URL slug
labelstringDisplay label
iconstringFont Awesome class
groupstring or nullGroup name if the entity belongs to a group

List Page (list.html, list_table.html)

VariableTypeDescription
columnsarray of stringsColumn names to display
column_typesmapMaps column name to field type string
rowsarrayRow data (see below)
searchstringCurrent search query
pageintegerCurrent page number
total_pagesintegerTotal number of pages
order_bystringColumn currently sorted
order_dirstring"asc" or "desc"
filter_fieldsarrayFields available as filters (see FieldContext below)
active_filtersmapCurrently applied filter values, keyed by field name
actionsarrayBulk/row actions (see ActionContext below)
bulk_deleteboolWhether bulk delete is enabled
bulk_exportboolWhether bulk CSV export is enabled
export_columnsarray of [name, label] pairsColumns available for export
can_createboolWhether the current user can create records
can_editboolWhether the current user can edit records
can_deleteboolWhether the current user can delete records

Row (rows[n])

FieldTypeDescription
idstringRecord primary key
datamapColumn name → display value (all strings)

ActionContext (actions[n])

FieldTypeDescription
namestringAction identifier used in the POST URL
labelstringButton label
targetstring"list" (bulk) or "row" (per-row)
confirmstring or nullConfirmation message, if any
iconstring or nullFont Awesome class for button icon
classstring or nullCustom CSS classes for the button

Form Page (form.html)

VariableTypeDescription
fieldsarrayField definitions (see FieldContext below)
valuesmapCurrent field values, keyed by field name
errorsmapValidation error messages, keyed by field name
is_createboolTrue when creating a new record, false when editing
record_idstringThe record's primary key (empty string on create)
csrf_tokenstringCSRF token to include in form submissions
can_saveboolWhether the current user can save this record

FieldContext (fields[n])

FieldTypeDescription
namestringField name (used as <input name>)
labelstringHuman-readable label
field_typestringOne of: Text, Textarea, Integer, Float, Boolean, Select, Date, DateTime, File, ManyToMany, Hidden
readonlyboolField is read-only
hiddenboolField is hidden entirely
list_onlyboolField only appears on list pages
form_onlyboolField only appears on form pages
requiredboolField is required
help_textstring or nullOptional help text shown below the field
optionsarray of [value, label] pairsOptions for Select fields
selected_idsarray of stringsCurrently selected IDs for ManyToMany fields
acceptarray of stringsAccepted MIME types for File fields

Change Password Page (change_password.html)

VariableTypeDescription
admin_titlestringAdmin panel title
admin_iconstringFont Awesome class for the sidebar logo icon
navarraySidebar navigation items (same shape as common nav)
current_entitystringAlways an empty string on this page
csrf_tokenstringCSRF token to include in the form submission
errorstring or nullInline error message (e.g. wrong current password)
successstring or nullInline success message after a successful password change
flash_successstring or nullSuccess flash message carried over from a redirect
flash_errorstring or nullError flash message carried over from a redirect

Login Page (login.html)

VariableTypeDescription
admin_titlestringAdmin panel title
errorstring or nullLogin error message
csrf_tokenstringCSRF token
nextstring or nullURL to redirect to after login

Flash Partial (flash.html)

VariableTypeDescription
successstring or nullSuccess message
errorstring or nullError message