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.RedirectView.url

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

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.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

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.RedirectView.get_redirect_url()

get_redirect_url(*args, **kwargs) Constructs the target URL for redirection. The default implementation uses url as a starting string and performs expansion of % named parameters in that string using the named groups captured in the URL. If url is not set, get_redirect_url() tries to reverse the pattern_name using what was captured in the URL (both named and unnamed groups are used). If requested by query_string, it will also append the query string to the generated URL. Subclasses may imple

views.generic.base.RedirectView

class django.views.generic.base.RedirectView Redirects to a given URL. The given URL may contain dictionary-style string formatting, which will be interpolated against the parameters captured in the URL. Because keyword interpolation is always done (even if no arguments are passed in), any "%" characters in the URL must be written as "%%" so that Python will convert them to a single percent sign on output. If the given URL is None, Django will return an HttpResponseGone (410). Ancestors (MRO

views.defaults.permission_denied()

defaults.permission_denied(request, exception, template_name='403.html') In the same vein as the 404 and 500 views, Django has a view to handle 403 Forbidden errors. If a view results in a 403 exception then Django will, by default, call the view django.views.defaults.permission_denied. This view loads and renders the template 403.html in your root template directory, or if this file does not exist, instead serves the text “403 Forbidden”, as per RFC 7231#section-6.5.3 (the HTTP 1.1 Specific

views.generic.base.RedirectView.pattern_name

pattern_name The name of the URL pattern to redirect to. Reversing will be done using the same args and kwargs as are passed in for this view.

views.generic.base.ContextMixin

class django.views.generic.base.ContextMixin Methods get_context_data(**kwargs) Returns a dictionary representing the template context. The keyword arguments provided will make up the returned context. Example usage: def get_context_data(self, **kwargs): context = super(RandomNumberView, self).get_context_data(**kwargs) context['number'] = random.randrange(1, 100) return context The template context of all class-based generic views include a view variable that points to the V