diff --git a/AUTHORS b/AUTHORS index e0c915512b..2fecddf36a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -60,6 +60,7 @@ answer newbie questions, and generally made Django that much better: Andrew Brehaut brut.alll@gmail.com Jonathan Buchanan + Paul Bx Antonio Cavedoni C8E Chris Chamberlin diff --git a/django/views/generic/simple.py b/django/views/generic/simple.py index 355bd25ef8..69a494931e 100644 --- a/django/views/generic/simple.py +++ b/django/views/generic/simple.py @@ -1,8 +1,8 @@ from django.shortcuts import render_to_response -from django.template import RequestContext +from django.template import loader, RequestContext from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone -def direct_to_template(request, template, extra_context={}, **kwargs): +def direct_to_template(request, template, extra_context={}, mimetype=None, **kwargs): """ Render a given template with any extra URL parameters in the context as ``{{ params }}``. @@ -13,7 +13,9 @@ def direct_to_template(request, template, extra_context={}, **kwargs): dictionary[key] = value() else: dictionary[key] = value - return render_to_response(template, dictionary, context_instance=RequestContext(request)) + c = RequestContext(request, dictionary) + t = loader.get_template(template) + return HttpResponse(t.render(c), mimetype=mimetype) def redirect_to(request, url, **kwargs): """