pub trait ModelAdmin: AdminModel {
// Provided methods
fn list_display() -> &'static [&'static str] { ... }
fn list_filter() -> &'static [&'static str] { ... }
fn search_fields() -> &'static [&'static str] { ... }
fn ordering() -> &'static [&'static str] { ... }
fn list_per_page() -> usize { ... }
fn readonly_fields() -> &'static [&'static str] { ... }
fn fieldsets() -> &'static [Fieldset] { ... }
}Expand description
Django-style customisation surface for a registered admin model.
Every type that implements AdminModel gets a default impl via
the blanket below. Override the methods you care about; everything
else inherits sensible defaults.
Provided Methods§
Sourcefn list_display() -> &'static [&'static str]
fn list_display() -> &'static [&'static str]
Columns shown on the list page, in order. Default: every
field declared on AdminModel::FIELDS.
Returning &[] means “use the model’s full field list” — the
list page expands the empty default into M::FIELDS. Any
non-empty slice replaces the defaults verbatim.
Sourcefn list_filter() -> &'static [&'static str]
fn list_filter() -> &'static [&'static str]
Columns offered as filter chips in the sidebar. Default: none.
Sourcefn search_fields() -> &'static [&'static str]
fn search_fields() -> &'static [&'static str]
Columns searched by the list-page search box (case-insensitive substring match). Default: none.
Sourcefn ordering() -> &'static [&'static str]
fn ordering() -> &'static [&'static str]
Default ordering. -foo for foo DESC, foo for foo ASC.
Multiple entries → multi-column ORDER BY in slice order.
Default: ["-id"] (newest first).
Sourcefn list_per_page() -> usize
fn list_per_page() -> usize
Rows per page on the list view. Default: 50.
Sourcefn readonly_fields() -> &'static [&'static str]
fn readonly_fields() -> &'static [&'static str]
Read-only fields on the change form. Default: none.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.