Класс 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.

Атрибуты

  Определено в
extra_context = None ContextMixin

Методы

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