diff options
author | Dan McGee <dan@archlinux.org> | 2013-12-15 13:33:50 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-12-15 13:33:50 -0600 |
commit | 77a45dc7bc6f0badb45ec043e85f1b542c52792e (patch) | |
tree | 6f922510656cf955145232ea092f643ec055c919 /mirrors | |
parent | 79aef280ddf0c704fd40d0077822a8ff7548437e (diff) |
Use select_related() in new mirror URL details view
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r-- | mirrors/views.py | 6 |
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, |