From dcb5bc32e0a475a514d3fdec8699c5fbe564b7ee Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 15 Nov 2005 16:55:26 +0000 Subject: [PATCH] Added django.views.generic.simple.direct_to_template which renders a given template along with any other params from the URL pattern. git-svn-id: http://code.djangoproject.com/svn/django/trunk@1247 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/generic/simple.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 django/views/generic/simple.py diff --git a/django/views/generic/simple.py b/django/views/generic/simple.py new file mode 100644 index 0000000000..4dffd69a47 --- /dev/null +++ b/django/views/generic/simple.py @@ -0,0 +1,9 @@ +from django.core import template_loader +from django.core.extensions import DjangoContext +from django.utils.httpwrappers import HttpResponse + +def direct_to_template(request, template, **kwargs): + """Render a given template with any extra parameters in the context.""" + t = template_loader.get_template(template) + c = DjangoContext(request, {'params' : kwargs}) + return HttpResponse(t.render(c)) \ No newline at end of file