Skip to content

The FAST_MODELADMIN dictionary

SimplePythonCoder edited this page Sep 24, 2026 · 2 revisions

Keys

Here will be listed all the keys that django-fast-modeladmin uses to modify the admin site.

Model

The most important key, this will register the model and make it available on the admin site.

FAST_MODELADMIN = ({'model': 'app_name.model_name'},)

make sure to use the correct app and model.

Columns

will set up which columns are shown on the model table page.
the first column will always be a link to the specific object.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'columns': ['col1', 'col2']},)

this will only work with the model fields.

Sort

will sort according to the column selected.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'sort': ['field']},)

works with:

  • reverse sorting by putting a "-" before the name
    FAST_MODELADMIN = ({'model': 'app_name.model_name', 'sort': ['-field']},)
  • foreign key connected field
    FAST_MODELADMIN = ({'model': 'app_name.model_name', 'sort': ['fk_field__field']},)
  • multi-field sorting
    FAST_MODELADMIN = ({'model': 'app_name.model_name', 'sort': ['field', 'another_field']},)

Search

allows to activate search for specific fields.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'search': ['field1', 'field2']},)

note that if two entries have the same value but in different fields, e.g. same first name and family name, it will show both entries.

Search Text

a line of text to be shown below the search box.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'search': ['field1'], 'search_text': 'this text will be shown below the search box'},)

Links

allows to select which additional columns will be links in the table page view.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'columns': ['col1', 'col2'...] 'links': ['col1', 'col2']},)

Editables

will allow you to change the value from the table page view.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'editables': ['col2']},)

IMPORTANT! the first column or a link cannot be in editables!

Read Only Fields

will allow you to block editing certain fields from the entry page.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'read_only_fields': ['field1']},)

Parts

allows you to separate the page into parts with labels and order the fields.

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'parts': [{'label': 'name', 'fields': ['field1']}]},)
  • label: name of the header
  • fields: fields below the specific header

note that you can't use a field more than once in all parts.

Actions

detects action functions inside the admin.py file (or another file using FAST_MODELADMIN_MODULES).

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'actions': ['function1']},)

Form

allows to attach a custom form to the entry page from the forms.py file (or another file using FAST_MODELADMIN_MODULES).

FAST_MODELADMIN = ({'model': 'app_name.model_name', 'form': 'FormClass'},)

Clone this wiki locally