ListView

class djcrud.views.list.ListView(**kwargs)[source]

Bases: ListMixin, SearchMixin, FilterMixin, PaginationMixin, Tables2Mixin, TemplateViewMixin, ModelMixin, ListView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get_queryset()[source]

Scoped queryset for list and action views.

get_filter_field_names()[source]

Sidebar filter field names from filter_fields.

DetailListView

class djcrud.views.list.DetailListView(**kwargs)[source]

Bases: DetailListMixin, ObjectMixin, ListView

List of related rows shown on an object detail page.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

property title

Page heading from the model’s verbose_name_plural.

get_queryset()[source]

For DetailListView the queryset is the related one (via get_related_queryset). This is the special case introduced here.

property table

In DetailListView we build the table on get_related_queryset() and use related_model for the table’s model.

property table_meta

Override in DetailListView to pass the right model (related_model if set) to the generated table.

get_object(queryset=None)[source]

Special case for DetailListView: the object being detailed is the parent (router model), while the list/table data comes from the related queryset.

We introduce the special handling here (in the special class) rather than changing base contracts. Base get_object uses get_queryset(), but here we provide the parent via our get_object_queryset.

get_object_queryset()[source]

Return queryset for the parent object (router model). This is part of the special handling introduced in DetailListView.

Use list_model (via DetailListMixin) when the rows shown on a detail page belong to a different model than the router (for example the built-in per-object history view from djcrud_history, which lists LogEntry rows for an object of the router’s model). The view’s .model for the list data (tables, etc.) will be the list model while object lookup and router-scoped querysets continue to use the parent model.