mirror of
https://github.com/django/django.git
synced 2025-09-08 19:50:48 +00:00
Accounted for multiple template engines in template responses.
This commit is contained in:
parent
a3e783fe11
commit
79deb6a071
11 changed files with 215 additions and 111 deletions
|
@ -1,6 +1,6 @@
|
|||
from django import http
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.template import Template
|
||||
from django.template import engines
|
||||
from django.template.response import TemplateResponse
|
||||
|
||||
|
||||
|
@ -9,11 +9,13 @@ def normal_view(request):
|
|||
|
||||
|
||||
def template_response(request):
|
||||
return TemplateResponse(request, Template('OK'))
|
||||
template = engines['django'].from_string('OK')
|
||||
return TemplateResponse(request, template)
|
||||
|
||||
|
||||
def template_response_error(request):
|
||||
return TemplateResponse(request, Template('{%'))
|
||||
template = engines['django'].from_string('{%')
|
||||
return TemplateResponse(request, template)
|
||||
|
||||
|
||||
def not_found(request):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue