Ticket #9309: template_loader_for_direct_to_template.patch

File template_loader_for_direct_to_template.patch, 1005 bytes (added by burp_, 7 years ago)
  • views/generic/simple.py

    diff --git a/views/generic/simple.py b/views/generic/simple.py
    index 0a68b82..6fe3123 100644
    a b  
    11from django.template import loader, RequestContext
    22from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
    33
    4 def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
     4def direct_to_template(request, template, extra_context=None, mimetype=None, template_loader=loader, **kwargs):
    55    """
    66    Render a given template with any extra URL parameters in the context as
    77    ``{{ params }}``.
    def direct_to_template(request, template, extra_context=None, mimetype=None, **k 
    1414        else:
    1515            dictionary[key] = value
    1616    c = RequestContext(request, dictionary)
    17     t = loader.get_template(template)
     17    t = template_loader.get_template(template)
    1818    return HttpResponse(t.render(c), mimetype=mimetype)
    1919
    2020def redirect_to(request, url, **kwargs):
Back to Top