From 872af225a98b9c328988e1cdbdea2ca73b8d185c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 3 Sep 2010 13:44:27 -0500 Subject: Use direct_to_template in all remaining possible places Rather than the need to include RequestContext() calls directly, we can just use direct_to_template to do all the work for us. Signed-off-by: Dan McGee --- mirrors/views.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'mirrors') diff --git a/mirrors/views.py b/mirrors/views.py index 378a0b4..b9a02d2 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -1,7 +1,7 @@ from django import forms -from django.shortcuts import render_to_response -from django.template import RequestContext from django.views.decorators.csrf import csrf_exempt +from django.views.generic.simple import direct_to_template + from main.models import Mirror, MirrorUrl, MirrorProtocol from main.utils import make_choice @@ -31,8 +31,7 @@ def generate(request): else: form = MirrorlistForm() - return render_to_response('mirrors/index.html', {'mirrorlist_form': form}, - context_instance=RequestContext(request)) + return direct_to_template(request, 'mirrors/index.html', {'mirrorlist_form': form}) def find_mirrors(request, countries=None, protocols=None): print 'protocols', protocols @@ -46,11 +45,9 @@ def find_mirrors(request, countries=None, protocols=None): if countries and 'all' not in countries: qset = qset.filter(mirror__country__in=countries) qset = qset.order_by('mirror__country', 'mirror__name', 'url') - res = render_to_response('mirrors/mirrorlist.txt', { + return direct_to_template(request, 'mirrors/mirrorlist.txt', { 'mirror_urls': qset, }, - mimetype='text/plain', - context_instance=RequestContext(request)) - return res + mimetype='text/plain') # vim: set ts=4 sw=4 et: -- cgit v1.2.3-24-g4f1b