=============Simple mixins=============``ContextMixin``================.. class:: django.views.generic.base.ContextMixin**Attributes**.. attribute:: extra_contextA dictionary to include in the context. This is a convenient way ofspecifying some context in:meth:`~django.views.generic.base.View.as_view`. Example usage::from django.views.generic import TemplateViewTemplateView.as_view(extra_context={'title': 'Custom Title'})**Methods**.. method:: get_context_data(**kwargs)Returns a dictionary representing the template context. The keywordarguments provided will make up the returned context. Example usage::def get_context_data(self, **kwargs):context = super().get_context_data(**kwargs)context['number'] = random.randrange(1, 100)return contextThe template context of all class-based generic views include a``view`` variable that points to the ``View`` instance... admonition:: Use ``alters_data`` where appropriateNote that having the view instance in the template context mayexpose potentially hazardous methods to template authors. Toprevent methods like this from being called in the template, set``alters_data=True`` on those methods. For more information, readthe documentation on :ref:`rendering a template context<alters-data-description>`.``TemplateResponseMixin``=========================.. class:: django.views.generic.base.TemplateResponseMixinProvides a mechanism to construct a:class:`~django.template.response.TemplateResponse`, givensuitable context. The template to use is configurable and can befurther customized by subclasses.**Attributes**.. attribute:: template_nameThe full name of a template to use as defined by a string. Not defininga ``template_name`` will raise a:class:`django.core.exceptions.ImproperlyConfigured` exception... attribute:: template_engineThe :setting:`NAME <TEMPLATES-NAME>` of a template engine to use forloading the template. ``template_engine`` is passed as the ``using``keyword argument to ``response_class``. Default is ``None``, whichtells Django to search for the template in all configured engines... attribute:: response_classThe response class to be returned by ``render_to_response`` method.Default is :class:`TemplateResponse<django.template.response.TemplateResponse>`. The template and contextof ``TemplateResponse`` instances can be altered later (e.g. in:ref:`template response middleware <template-response-middleware>`).If you need custom template loading or custom context objectinstantiation, create a ``TemplateResponse`` subclass and assign it to``response_class``... attribute:: content_typeThe content type to use for the response. ``content_type`` is passedas a keyword argument to ``response_class``. Default is ``None`` --meaning that Django uses ``'text/html'``.**Methods**.. method:: render_to_response(context, **response_kwargs)Returns a ``self.response_class`` instance.If any keyword arguments are provided, they will be passed to theconstructor of the response class.Calls :meth:`get_template_names()` to obtain the list of template namesthat will be searched looking for an existent template... method:: get_template_names()Returns a list of template names to search for when rendering thetemplate. The first template that is found will be used.The default implementation will return a list containing:attr:`template_name` (if it is specified).