Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit dcb5bc32e0a475a514d3fdec8699c5fbe564b7ee 1 parent 2c61aff
Jacob Kaplan-Moss jacobian authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 django/views/generic/simple.py
9 django/views/generic/simple.py
View
@@ -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))
Please sign in to comment.
Something went wrong with that request. Please try again.