Класс ContextMixin (Django 3.2)

from django.views.generic.base import ContextMixin

A default context mixin that passes the keyword arguments received by get_context_data() as the template context.

Attributes

  Defined in
extra_context = None ContextMixin

Methods

def get_context_data(self, **kwargs):
    kwargs.setdefault('view', self)
    if self.extra_context is not None:
        kwargs.update(self.extra_context)
    return kwargs