Refs #15241 -- Further clarifications to the generic view migration docs.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15481 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2011-02-09 13:04:05 +00:00
parent 8c59905033
commit 1ca9ceda59
1 changed files with 7 additions and 2 deletions

View File

@ -145,9 +145,14 @@ processors when rendering template content.
Class-based views don't provide a ``context_processors`` argument. Class-based views don't provide a ``context_processors`` argument.
Instead, you subclass the view, overriding Instead, you subclass the view, overriding
:meth:`TemplateResponseMixin.render_to_response()`. For example:: :meth:`TemplateResponseMixin.render_to_response()`, and passing in
a context instance that has been instantiated with the processors
you want to use. For example::
class MyListView(ListView): class MyListView(ListView):
def render_to_response(self, context, **kwargs): def render_to_response(self, context, **kwargs):
return super(MyListView, self).render_to_response( return super(MyListView, self).render_to_response(
RequestContext(self.request, context, processors=[custom_processor]), **kwargs) RequestContext(self.request,
context,
processors=[custom_processor]),
**kwargs)