mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
2c61aff523
commit
dcb5bc32e0
|
@ -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))
|
Loading…
Reference in New Issue