Views¶
View classes for displaying stories and categories.
Mixins¶
StoriesConfigMixin¶
BaseConfigListViewMixin¶
- class BaseConfigListViewMixin¶
Bases:
StoriesConfigMixin- optimize(qs)¶
Apply select_related / prefetch_related to optimize the view queries :param qs: queryset to optimize :return: optimized queryset
- get_view_url()¶
- get_queryset()¶
- get_template_names()¶
- get_context_data(**kwargs)¶
- get_paginate_by(queryset)¶
Detail Views¶
PostDetailView¶
- class PostDetailView(**kwargs)¶
Bases:
StoriesConfigMixin,DetailView- model¶
alias of
PostContent
- context_object_name = 'post_content'¶
- base_template_name = 'post_detail.html'¶
- slug_field = 'slug'¶
- view_url_name = 'djangocms_stories:post-detail'¶
- instant_article = False¶
- get(request, *args, **kwargs)¶
Make toolbar object’s apphook config available
- get_template_names()¶
Return a list of template names to be used for the request. May not be called if render_to_response() is overridden. Return a list containing
template_name, if set on the value. Otherwise, return a list containing:the contents of the
template_name_fieldfield on the object instance that the view is operating upon (if available)<app_label>/<model_name><template_name_suffix>.html
- get_queryset()¶
Return the QuerySet that will be used to look up the object.
This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.
- get_object()¶
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- get_context_data(**kwargs)¶
Insert the single object into the context dict.
ToolbarDetailView¶
- class ToolbarDetailView(**kwargs)¶
Bases:
PostDetailViewMimics DetailView but takes content object from render function
- get_object()¶
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
List Views¶
PostListView¶
- class PostListView(**kwargs)¶
Bases:
BaseConfigListViewMixin,ListView- model¶
alias of
PostContent
- base_template_name = 'post_list.html'¶
- view_url_name = 'djangocms_stories:posts-latest'¶
CategoryListView¶
- class CategoryListView(**kwargs)¶
Bases:
StoriesConfigMixin,ViewUrlMixin,TranslatableSlugMixin,ListView- model¶
alias of
PostCategory
- context_object_name = 'category_list'¶
- base_template_name = 'category_list.html'¶
- view_url_name = 'djangocms_stories:categories-all'¶
The default view name used by
get_view_url(), which should correspond with the view name in the URLConf.
- get_queryset()¶
Return the list of items for this view.
The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.
- get_template_names()¶
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response is overridden.
CategoryEntriesView¶
- class CategoryEntriesView(**kwargs)¶
Bases:
BaseConfigListViewMixin,ListView- model¶
alias of
PostContent
- context_object_name = 'postcontent_list'¶
- base_template_name = 'post_list.html'¶
- view_url_name = 'djangocms_stories:posts-category'¶
- property category¶
- get_queryset()¶
Return the list of items for this view.
The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.
- get_context_data(**kwargs)¶
Get the context for this view.
TaggedListView¶
- class TaggedListView(**kwargs)¶
Bases:
BaseConfigListViewMixin,ListView- model¶
alias of
PostContent
- context_object_name = 'postcontent_list'¶
- base_template_name = 'post_list.html'¶
- view_url_name = 'djangocms_stories:posts-tagged'¶
- get_queryset()¶
Return the list of items for this view.
The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.
- get_context_data(**kwargs)¶
Get the context for this view.
Archive Views¶
PostArchiveView¶
- class PostArchiveView(**kwargs)¶
Bases:
BaseConfigListViewMixin,ListView- model¶
alias of
PostContent
- context_object_name = 'postcontent_list'¶
- base_template_name = 'post_list.html'¶
- date_field = 'date_published'¶
- allow_empty = True¶
- allow_future = True¶
- view_url_name = 'djangocms_stories:posts-archive'¶
- get_queryset()¶
Return the list of items for this view.
The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.
- get_context_data(**kwargs)¶
Get the context for this view.