Ticket #2966: direct_to_template-extra_context.patch
File direct_to_template-extra_context.patch, 867 bytes (added by , 18 years ago) |
---|
-
simple.py
2 2 from django.template import RequestContext 3 3 from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone 4 4 5 def direct_to_template(request, template, **kwargs):5 def direct_to_template(request, template, extra_context=None, **kwargs): 6 6 """ 7 7 Render a given template with any extra URL parameters in the context as 8 8 ``{{ params }}``. 9 9 """ 10 return render_to_response(template, {'params' : kwargs}, context_instance=RequestContext(request)) 10 if extra_context is None: extra_context = {} 11 return render_to_response(template, dict(extra_context, params=kwargs), context_instance=RequestContext(request)) 11 12 12 13 def redirect_to(request, url, **kwargs): 13 14 """