Класс ContextMixin (Django 2.1)

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

Методы

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