Skip to content

Commit

Permalink
Fixed #3034 -- Added mimetype parameter to the direct_to_template() g…
Browse files Browse the repository at this point in the history
…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
malcolmt committed Apr 9, 2007
1 parent 3720154 commit 936a46c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -60,6 +60,7 @@ answer newbie questions, and generally made Django that much better:
Andrew Brehaut <http://brehaut.net/blog>
brut.alll@gmail.com
Jonathan Buchanan <jonathan.buchanan@gmail.com>
Paul Bx <pb@e-scribe.com>
Antonio Cavedoni <http://cavedoni.com/>
C8E
Chris Chamberlin <dja@cdc.msbx.net>
Expand Down
8 changes: 5 additions & 3 deletions 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 }}``.
Expand All @@ -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):
"""
Expand Down

0 comments on commit 936a46c

Please sign in to comment.