Views

These are the Django Class-based views used to implement HTML pages enabled from application urls.py.

class djangoapp_sample.views.article.ArticleDetailView(**kwargs)[source]

Article detail

pk_url_kwarg = 'article_pk'
template_name = 'djangoapp_sample/article_detail.html'
context_object_name = 'article_object'
get_queryset()[source]

Get article object, we validate it is related to required blog from query argument and set the blog object as an attribute for template context.

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

class djangoapp_sample.views.blog.BlogIndexView(**kwargs)[source]

List of blogs

model

alias of Blog

queryset
template_name = 'djangoapp_sample/blog_index.html'
paginate_by = 5
class djangoapp_sample.views.blog.BlogDetailView(**kwargs)[source]

Blog detail and its related article list

pk_url_kwarg = 'blog_pk'
template_name = 'djangoapp_sample/blog_detail.html'
paginate_by = 6
context_object_name = 'blog_object'
get_queryset()[source]

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(request, *args, **kwargs)[source]