summaryrefslogtreecommitdiff
path: root/mirrors/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-09-03 13:44:27 -0500
committerDan McGee <dan@archlinux.org>2010-09-03 13:45:13 -0500
commit872af225a98b9c328988e1cdbdea2ca73b8d185c (patch)
tree2d0e486f2321f5113f3e0b9e6c7625c2d76d64de /mirrors/views.py
parent7c7f57f6ac43af5350f04c6eaeb927063ad4daee (diff)
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 <dan@archlinux.org>
Diffstat (limited to 'mirrors/views.py')
-rw-r--r--mirrors/views.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index 378a0b42..b9a02d27 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: