Add missing imports and models to the examples in the view layer documentation

This commit is contained in:
Silvan Spross 2013-05-18 14:00:52 +02:00 committed by Marc Egli
parent e4591debd1
commit cd72c55d86
8 changed files with 57 additions and 2 deletions

View file

@ -215,6 +215,7 @@ re-rendered, you can re-evaluate the rendered content, and assign
the content of the response manually::
# Set up a rendered TemplateResponse
>>> from django.template.response import TemplateResponse
>>> t = TemplateResponse(request, 'original.html', {})
>>> t.render()
>>> print(t.content)
@ -256,6 +257,8 @@ To define a post-render callback, just define a function that takes
a single argument -- response -- and register that function with
the template response::
from django.template.response import TemplateResponse
def my_render_callback(response):
# Do content-sensitive processing
do_post_processing()