Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #3034 -- Added mimetype parameter to the direct_to_template() g…

…eneric

view, for consistency with the other generic views. Thanks, Paul Bx.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 936a46cc89dda9971ef1b8099cb260e98dbf50a7 1 parent 3720154
Malcolm Tredinnick authored April 09, 2007
1  AUTHORS
@@ -60,6 +60,7 @@ answer newbie questions, and generally made Django that much better:
60 60
     Andrew Brehaut <http://brehaut.net/blog>
61 61
     brut.alll@gmail.com
62 62
     Jonathan Buchanan <jonathan.buchanan@gmail.com>
  63
+    Paul Bx <pb@e-scribe.com>
63 64
     Antonio Cavedoni <http://cavedoni.com/>
64 65
     C8E
65 66
     Chris Chamberlin <dja@cdc.msbx.net>
8  django/views/generic/simple.py
... ...
@@ -1,8 +1,8 @@
1 1
 from django.shortcuts import render_to_response
2  
-from django.template import RequestContext
  2
+from django.template import loader, RequestContext
3 3
 from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
4 4
 
5  
-def direct_to_template(request, template, extra_context={}, **kwargs):
  5
+def direct_to_template(request, template, extra_context={}, mimetype=None, **kwargs):
6 6
     """
7 7
     Render a given template with any extra URL parameters in the context as
8 8
     ``{{ params }}``.
@@ -13,7 +13,9 @@ def direct_to_template(request, template, extra_context={}, **kwargs):
13 13
             dictionary[key] = value()
14 14
         else:
15 15
             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)
17 19
 
18 20
 def redirect_to(request, url, **kwargs):
19 21
     """

0 notes on commit 936a46c

Please sign in to comment.
Something went wrong with that request. Please try again.