Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed django.views.admin.template to use render_to_response, to cut…

… on code

git-svn-id: http://code.djangoproject.com/svn/django/trunk@675 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3b49ecea63f2c9e6fd5b5b4b06e55b57008c6e49 1 parent a089b8f
@adrianholovaty adrianholovaty authored
Showing with 3 additions and 6 deletions.
  1. +3 −6 django/views/admin/template.py
View
9 django/views/admin/template.py
@@ -1,7 +1,6 @@
from django.core import formfields, template_loader, validators
from django.core import template
-from django.core.extensions import DjangoContext as Context
-from django.utils.httpwrappers import HttpResponse
+from django.core.extensions import DjangoContext, render_to_response
from django.models.core import sites
from django.conf import settings
@@ -22,12 +21,10 @@ def template_validator(request):
errors = manipulator.get_validation_errors(new_data)
if not errors:
request.user.add_message('The template is valid.')
- t = template_loader.get_template('template_validator')
- c = Context(request, {
+ return render_to_response('template_validator', {
'title': 'Template validator',
'form': formfields.FormWrapper(manipulator, new_data, errors),
- })
- return HttpResponse(t.render(c))
+ }, context_instance=DjangoContext(request))
class TemplateValidator(formfields.Manipulator):
def __init__(self, settings_modules):
Please sign in to comment.
Something went wrong with that request. Please try again.