Ticket #3034: dtt_mimetype.diff

File dtt_mimetype.diff, 1.2 KB (added by Paul Bx <pb@…>, 9 years ago)

the patch

  • usr/local/www/django/trunk/django/views/generic/simple.py

     
    11from django.shortcuts import render_to_response
    2 from django.template import RequestContext
     2from django.template import loader, RequestContext
    33from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
    44
    5 def direct_to_template(request, template, extra_context={}, **kwargs):
     5def direct_to_template(request, template, extra_context={}, mimetype="text/html", **kwargs):
    66    """
    77    Render a given template with any extra URL parameters in the context as
    88    ``{{ params }}``.
     
    1313            dictionary[key] = value()
    1414        else:
    1515            dictionary[key] = value
    16     return render_to_response(template, dictionary, context_instance=RequestContext(request))
     16    c = RequestContext(request, dictionary)
     17    t = loader.get_template(template)
     18    return HttpResponse(t.render(c), mimetype=mimetype)
    1719
    1820def redirect_to(request, url, **kwargs):
    1921    """
Back to Top