Ticket #3034: dtt_mimetype.diff
File dtt_mimetype.diff, 1.2 KB (added by , 18 years ago) |
---|
-
usr/local/www/django/trunk/django/views/generic/simple.py
1 1 from django.shortcuts import render_to_response 2 from django.template import RequestContext2 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="text/html", **kwargs): 6 6 """ 7 7 Render a given template with any extra URL parameters in the context as 8 8 ``{{ params }}``. … … 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 """