views.generic.base.RedirectView.query_string

query_string Whether to pass along the GET query string to the new location. If True, then the query string is appended to the URL. If False, then the query string is discarded. By default, query_string is False. Methods

views.generic.base.RedirectView.url

url The URL to redirect to, as a string. Or None to raise a 410 (Gone) HTTP error.

views.generic.base.TemplateResponseMixin

class django.views.generic.base.TemplateResponseMixin Provides a mechanism to construct a TemplateResponse, given suitable context. The template to use is configurable and can be further customized by subclasses. Attributes template_name The full name of a template to use as defined by a string. Not defining a template_name will raise a django.core.exceptions.ImproperlyConfigured exception. template_engine The NAME of a template engine to use for loading the template. template_engin

views.generic.base.TemplateResponseMixin.content_type

content_type The content type to use for the response. content_type is passed as a keyword argument to response_class. Default is None – meaning that Django uses DEFAULT_CONTENT_TYPE. Methods

views.generic.base.TemplateResponseMixin.get_template_names()

get_template_names() Returns a list of template names to search for when rendering the template. The first template that is found will be used. If template_name is specified, the default implementation will return a list containing template_name (if it is specified).

views.generic.base.TemplateResponseMixin.render_to_response()

render_to_response(context, **response_kwargs) Returns a self.response_class instance. If any keyword arguments are provided, they will be passed to the constructor of the response class. Calls get_template_names() to obtain the list of template names that will be searched looking for an existent template.

views.generic.base.TemplateResponseMixin.response_class

response_class The response class to be returned by render_to_response method. Default is TemplateResponse. The template and context of TemplateResponse instances can be altered later (e.g. in template response middleware). If you need custom template loading or custom context object instantiation, create a TemplateResponse subclass and assign it to response_class.

views.generic.base.TemplateResponseMixin.template_engine

template_engine The NAME of a template engine to use for loading the template. template_engine is passed as the using keyword argument to response_class. Default is None, which tells Django to search for the template in all configured engines.

views.generic.base.TemplateResponseMixin.template_name

template_name The full name of a template to use as defined by a string. Not defining a template_name will raise a django.core.exceptions.ImproperlyConfigured exception.

views.generic.base.TemplateView

class django.views.generic.base.TemplateView Renders a given template, with the context containing parameters captured in the URL. Ancestors (MRO) This view inherits methods and attributes from the following views: django.views.generic.base.TemplateResponseMixin django.views.generic.base.ContextMixin django.views.generic.base.View Method Flowchart dispatch() http_method_not_allowed() get_context_data() Example views.py: from django.views.generic.base import TemplateView from articles.mo