mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #12815 -- Added TemplateResponse, a lazy-evaluated Response class. Thanks to Simon Willison for the original idea, and to Mikhail Korobov and Ivan Sagalaev for their assistance, including the draft patch from Mikhail.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
22fc30be5a
commit
e0dcd7666a
19 changed files with 842 additions and 210 deletions
|
@ -1,9 +1,18 @@
|
|||
from django import http
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.template import Template
|
||||
from django.template.response import TemplateResponse
|
||||
|
||||
|
||||
def normal_view(request):
|
||||
return http.HttpResponse('OK')
|
||||
|
||||
def template_response(request):
|
||||
return TemplateResponse(request, Template('OK'))
|
||||
|
||||
def template_response_error(request):
|
||||
return TemplateResponse(request, Template('{%'))
|
||||
|
||||
def not_found(request):
|
||||
raise http.Http404()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue