Skip to main content

MultipleObjectMixin

Trait MultipleObjectMixin 

Source
pub trait MultipleObjectMixin<T>: Send + Sync
where T: Model + Serialize + Send + Sync + Clone,
{ // Required method fn get_objects<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; // Provided methods fn get_ordering(&self) -> Option<Vec<String>> { ... } fn allow_empty(&self) -> bool { ... } fn get_paginate_by(&self) -> Option<usize> { ... } fn get_context_object_name(&self) -> Option<&str> { ... } fn get_context_data( &self, object_list: Vec<T>, ) -> Result<HashMap<String, Value>, Error> { ... } }
Available on non-WebAssembly only.
Expand description

Trait for views that work with multiple objects

Required Methods§

Source

fn get_objects<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get objects for this view

Provided Methods§

Source

fn get_ordering(&self) -> Option<Vec<String>>

Get the ordering for the queryset

Source

fn allow_empty(&self) -> bool

Whether to allow empty result sets

Source

fn get_paginate_by(&self) -> Option<usize>

Get the number of items per page

Source

fn get_context_object_name(&self) -> Option<&str>

Get the context object name

Source

fn get_context_data( &self, object_list: Vec<T>, ) -> Result<HashMap<String, Value>, Error>

Build context data for the view

Implementors§

Source§

impl<T> MultipleObjectMixin<T> for ListView<T>
where T: Model + Serialize + for<'de> Deserialize<'de> + Send + Sync + Clone + 'static,