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 theView
instance.Use
alters_data
where appropriateNote that having the view instance in the template context may expose potentially hazardous methods to template authors. To prevent methods like this from being called in the template, set
alters_data=True
on those methods. For more information, read the documentation on rendering a template context.
Please login to continue.