summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-12-15 13:33:50 -0600
committerDan McGee <dan@archlinux.org>2013-12-15 13:33:50 -0600
commit77a45dc7bc6f0badb45ec043e85f1b542c52792e (patch)
tree6f922510656cf955145232ea092f643ec055c919
parent79aef280ddf0c704fd40d0077822a8ff7548437e (diff)
Use select_related() in new mirror URL details view
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/views.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index b2e75b25..34336165 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -201,7 +201,8 @@ def mirror_details_json(request, name):
def url_details(request, name, url_id):
- url = get_object_or_404(MirrorUrl, id=url_id, mirror__name=name)
+ url = get_object_or_404(MirrorUrl.objects.select_related(),
+ id=url_id, mirror__name=name)
mirror = url.mirror
authorized = request.user.is_authenticated()
if not authorized and \
@@ -209,7 +210,8 @@ def url_details(request, name, url_id):
raise Http404
error_cutoff = timedelta(days=7)
cutoff_time = now() - error_cutoff
- logs = MirrorLog.objects.filter(url=url, check_time__gte=cutoff_time).order_by('-check_time')
+ logs = MirrorLog.objects.select_related('location').filter(
+ url=url, check_time__gte=cutoff_time).order_by('-check_time')
context = {
'url': url,