You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Controls where on the page the actions bar appears.
35
+
# By default, the admin changelist displays actions at the top of the page (actions_on_top = False; actions_on_bottom = True). # noqa: E501
36
+
# Example of usage: actions_on_top = True
37
+
actions_on_top: bool=False
38
+
39
+
# Controls where on the page the actions bar appears.
40
+
# By default, the admin changelist displays actions at the top of the page (actions_on_top = False; actions_on_bottom = True). # noqa: E501
41
+
# Example of usage: actions_on_bottom = False
42
+
actions_on_bottom: bool=True
43
+
44
+
# Controls whether a selection counter is displayed next to the action dropdown. By default, the admin changelist will display it # noqa: E501
45
+
# Example of usage: actions_selection_counter = False
46
+
actions_selection_counter: bool=True
30
47
31
48
# Not supported setting
32
49
# date_hierarchy
33
50
34
51
# This attribute overrides the default display value for record’s fields that are empty (None, empty string, etc.). The default value is - (a dash). # noqa: E501
52
+
# Example of usage: empty_value_display = "N/A"
35
53
empty_value_display: str="-"
36
54
37
55
# This attribute, if given, should be a list of field names to exclude from the form.
56
+
# Example of usage: exclude = ("password", "otp")
38
57
exclude: Sequence[str] = ()
39
58
40
59
# Use the fields option to make simple layout changes in the forms on the “add” and “change” pages
41
60
# such as showing only a subset of available fields, modifying their order, or grouping them into rows.
42
61
# For more complex layout needs, see the fieldsets option.
62
+
# Example of usage: fields = ("id", "mobile_number", "email", "is_superuser", "is_active", "created_at")
43
63
fields: Sequence[str] = ()
44
64
45
65
# Set fieldsets to control the layout of admin “add” and “change” pages.
46
66
# fieldsets is a list of two-tuples, in which each two-tuple represents a <fieldset> on the admin form page. (A <fieldset> is a “section” of the form.) # noqa: E501
# By default, a ManyToManyField is displayed in the admin site with a <select multiple>.
69
+
# By default, a ManyToManyField is displayed in the admin dashboard with a <select multiple>.
50
70
# However, multiple-select boxes can be difficult to use when selecting many items.
51
71
# Adding a ManyToManyField to this list will instead use a nifty unobtrusive JavaScript “filter” interface that allows searching within the options. # noqa: E501
52
72
# The unselected and selected options appear in two boxes side by side. See filter_vertical to use a vertical interface. # noqa: E501
73
+
# Example of usage: filter_horizontal = ("groups", "user_permissions")
53
74
filter_horizontal: Sequence[str] = ()
54
75
55
76
# Same as filter_horizontal, but uses a vertical display of the filter interface with the box of unselected options appearing above the box of selected options. # noqa: E501
77
+
# Example of usage: filter_vertical = ("groups", "user_permissions")
56
78
filter_vertical: Sequence[str] = ()
57
79
58
80
# Not supported setting
@@ -66,27 +88,34 @@ class BaseModelAdmin:
66
88
67
89
# Set list_display to control which fields are displayed on the list page of the admin.
68
90
# If you don’t set list_display, the admin site will display a single column that displays the __str__() representation of each object # noqa: E501
91
+
# Example of usage: list_display = ("id", "mobile_number", "email", "is_superuser", "is_active", "created_at")
69
92
list_display: Sequence[str] = ()
70
93
71
94
# Use list_display_links to control if and which fields in list_display should be linked to the “change” page for an object. # noqa: E501
95
+
# Example of usage: list_display_links = ("id", "mobile_number", "email")
72
96
list_display_links: Sequence[str] = ()
73
97
74
98
# Set list_filter to activate filters in the tabel columns of the list page of the admin.
99
+
# Example of usage: list_filter = ("is_superuser", "is_active", "created_at")
75
100
list_filter: Sequence[str] = ()
76
101
77
102
# Set list_max_show_all to control how many items can appear on a “Show all” admin change list page.
78
103
# The admin will display a “Show all” link on the change list only if the total result count is less than or equal to this setting. By default, this is set to 200. # noqa: E501
104
+
# Example of usage: list_max_show_all = 100
79
105
list_max_show_all: int=200
80
106
81
107
# Set list_per_page to control how many items appear on each paginated admin list page. By default, this is set to 10. # noqa: E501
108
+
# Example of usage: list_per_page = 50
82
109
list_per_page=10
83
110
84
111
# Set list_select_related to tell ORM to use select_related() in retrieving the list of objects on the admin list page. # noqa: E501
85
112
# This can save you a bunch of database queries.
113
+
# Example of usage: list_select_related = ("user",)
86
114
list_select_related: Sequence[str] = ()
87
115
88
116
# Set ordering to specify how lists of objects should be ordered in the admin views.
89
117
# This should be a list or tuple in the same format as a model’s ordering parameter.
118
+
# Example of usage: ordering = ("-created_at",)
90
119
ordering: Sequence[str] = ()
91
120
92
121
# Not supported setting
@@ -102,10 +131,12 @@ class BaseModelAdmin:
102
131
103
132
# By default, applied filters are preserved on the list view after creating, editing, or deleting an object.
104
133
# You can have filters cleared by setting this attribute to False.
134
+
# Example of usage: preserve_filters = False
105
135
preserve_filters: bool=True
106
136
107
137
# By default, FastAPI admin uses a select-box interface (<select>) for fields that are ForeignKey or have choices set. # noqa: E501
108
138
# If a field is present in radio_fields, FastAPI admin will use a radio-button interface instead.
139
+
# Example of usage: radio_fields = ("user",)
109
140
radio_fields: Sequence[str] = ()
110
141
111
142
# Not supported setting (all fk, m2m uses select js widget as default)
@@ -114,45 +145,55 @@ class BaseModelAdmin:
114
145
# By default, FastAPI admin uses a select-box interface (<select>) for fields that are ForeignKey.
115
146
# Sometimes you don’t want to incur the overhead of having to select all the related instances to display in the drop-down. # noqa: E501
116
147
# raw_id_fields is a list of fields you would like to change into an Input widget for either a ForeignKey or ManyToManyField. # noqa: E501
148
+
# Example of usage: raw_id_fields = ("user",)
117
149
raw_id_fields: Sequence[str] = ()
118
150
119
151
# By default the admin shows all fields as editable.
120
152
# Any fields in this option (which should be a list or tuple) will display its data as-is and non-editable.
153
+
# Example of usage: readonly_fields = ("created_at",)
121
154
readonly_fields: Sequence[str] = ()
122
155
123
156
# Normally, objects have three save options: “Save”, “Save and continue editing”, and “Save and add another”.
124
157
# If save_as is True, “Save and add another” will be replaced
125
158
# by a “Save as new” button that creates a new object (with a new ID) rather than updating the existing object.
159
+
# Example of usage: save_as = True
126
160
save_as: bool=False
127
161
128
162
# When save_as_continue=True, the default redirect after saving the new object is to the change view for that object. # noqa: E501
129
163
# If you set save_as_continue=False, the redirect will be to the changelist view.
164
+
# Example of usage: save_as_continue = False
130
165
save_as_continue: bool=False
131
166
132
167
# Normally, the save buttons appear only at the bottom of the forms.
133
168
# If you set save_on_top, the buttons will appear both on the top and the bottom.
169
+
# Example of usage: save_on_top = True
134
170
save_on_top: bool=False
135
171
136
172
# Set search_fields to enable a search box on the admin list page.
137
173
# This should be set to a list of field names that will be searched whenever somebody submits a search query in that text box. # noqa: E501
174
+
# Example of usage: search_fields = ("mobile_number", "email")
138
175
search_fields: Sequence[str] = ()
139
176
140
177
# Set search_help_text to specify a descriptive text for the search box which will be displayed below it.
178
+
# Example of usage: search_help_text = "Search by mobile number or email"
141
179
search_help_text: str=""
142
180
143
181
# Set show_full_result_count to control whether the full count of objects should be displayed
144
182
# on a filtered admin page (e.g. 99 results (103 total)).
145
183
# If this option is set to False, a text like 99 results (Show all) is displayed instead.
184
+
# Example of usage: show_full_result_count = True
146
185
show_full_result_count: bool=False
147
186
148
187
# By default, the list page allows sorting by all model fields
149
188
# If you want to disable sorting for some columns, set sortable_by to a collection (e.g. list, tuple, or set)
150
189
# of the subset of list_display that you want to be sortable.
151
190
# An empty collection disables sorting for all columns.
191
+
# Example of usage: sortable_by = ("mobile_number", "email")
152
192
sortable_by: Sequence[str] = ()
153
193
154
194
# Set view_on_site to control whether or not to display the “View on site” link.
155
195
# This link should bring you to a URL where you can display the saved object.
196
+
# Example of usage: view_on_site = "http://example.com"
0 commit comments