From 3b49ecea63f2c9e6fd5b5b4b06e55b57008c6e49 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 23 Sep 2005 21:53:53 +0000 Subject: [PATCH] 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 --- django/views/admin/template.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/django/views/admin/template.py b/django/views/admin/template.py index f2004a4d94..2bf4f1a1d8 100644 --- a/django/views/admin/template.py +++ b/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):