1. Luke Plant
  2. django


ja...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed bebfac7

Added django.views.generic.simple.direct_to_template which renders a given template along with any other params from the URL pattern.

  • Participants
  • Parent commits 96c2436
  • Branches default

Comments (0)

Files changed (1)

File django/views/generic/simple.py

View file
+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))