pub trait AdminModel:
Any
+ Send
+ 'static {
// Required methods
fn get_objects<'life0, 'async_trait>(
request: &'life0 Request,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Vec<Self>>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait;
fn get_total_object_counts<'life0, 'async_trait>(
request: &'life0 Request,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait;
fn get_object_by_id<'life0, 'life1, 'async_trait>(
request: &'life0 Request,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn name() -> &'static str
where Self: Sized;
fn url_name() -> &'static str
where Self: Sized;
fn id(&self) -> String;
fn display(&self) -> String;
fn form_context() -> Box<dyn FormContext>
where Self: Sized;
fn form_context_from_self<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn FormContext>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save_from_request<'life0, 'life1, 'async_trait>(
request: &'life0 mut Request,
object_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn FormContext>>>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_by_id<'life0, 'life1, 'async_trait>(
request: &'life0 mut Request,
object_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A model that can be managed by the admin panel.
Required Methods§
Sourcefn get_objects<'life0, 'async_trait>(
request: &'life0 Request,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Vec<Self>>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
fn get_objects<'life0, 'async_trait>(
request: &'life0 Request,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Vec<Self>>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
Get the objects of this model.
Sourcefn get_total_object_counts<'life0, 'async_trait>(
request: &'life0 Request,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
fn get_total_object_counts<'life0, 'async_trait>(
request: &'life0 Request,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
Get the total count of objects of this model.
Sourcefn get_object_by_id<'life0, 'life1, 'async_trait>(
request: &'life0 Request,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_object_by_id<'life0, 'life1, 'async_trait>(
request: &'life0 Request,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns the object with the given ID.
Sourcefn form_context() -> Box<dyn FormContext>where
Self: Sized,
fn form_context() -> Box<dyn FormContext>where
Self: Sized,
Get the form context for this model.
Sourcefn form_context_from_self<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn FormContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn form_context_from_self<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn FormContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the form context with the data pre-filled from this model instance.
Sourcefn save_from_request<'life0, 'life1, 'async_trait>(
request: &'life0 mut Request,
object_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn FormContext>>>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_from_request<'life0, 'life1, 'async_trait>(
request: &'life0 mut Request,
object_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn FormContext>>>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save the model instance from the form data in the request.
§Errors
Returns an error if the object could not be saved, for instance due to a database error.
Sourcefn remove_by_id<'life0, 'life1, 'async_trait>(
request: &'life0 mut Request,
object_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_by_id<'life0, 'life1, 'async_trait>(
request: &'life0 mut Request,
object_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove the model instance with the given ID.
§Errors
Returns an error if the object with the given ID does not exist.
Returns an error if the object could not be removed, for instance due to a database error.
Implementors§
impl AdminModel for DatabaseUser
Available on crate feature
db only.