Collection¶
- class cruditor.collection.CollectionViewMixin[source]¶
Bases:
object
Mixin to provide some extra default functionality to Cruditor views to make building views for a collection of data (like a Django model) even easier.
- collection_list_urlname = None[source]¶
URL name to use when linking to the list view (e.g. in breadcrumb)
- collection_detail_urlname = None[source]¶
URL name when linking to a detail page of a item (e.g. in list table or breadcrumb)
- get_title()[source]¶
The method calls the
get_collection_list_title
method when the view is a list view. All other views rely on the default behavior of cruditor.
- get_breadcrumb_title()[source]¶
The breadcrumb title returns “Delete” for delete views, default breadcrumb for all other views.
- get_breadcrumb()[source]¶
This method creates the required breadcrumb items for the collection following some rules:
No extra items for list view
list view element when the
collection_include_list_crumb
method is true.detail view element when the
collection_include_detail_crumb
method is true.
- get_table_class()[source]¶
This method returns the django-tables2 Table class to use in the list view. If no class is defined, a new Table class is created (with one linked column).
- collection_include_list_crumb()[source]¶
If this method returns true, the list view should be included in the breadcrumb.
- collection_include_detail_crumb()[source]¶
If this method returns true, the detail view should be included in the breadcrumb.
- get_collection_list_title()[source]¶
Helper method to override the used collection list title. By default, just returns the class
collection_list_title
property.
- get_collection_list_url()[source]¶
Helper method to generate the collection list url. By default, just calls reverse with the
collection_list_urlname
property.