diff options
author | Dan McGee <dan@archlinux.org> | 2013-12-15 20:33:50 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-12-15 20:33:50 +0100 |
commit | 77a45dc7bc6f0badb45ec043e85f1b542c52792e (patch) | |
tree | 6f922510656cf955145232ea092f643ec055c919 /mirrors | |
parent | 79aef280ddf0c704fd40d0077822a8ff7548437e (diff) | |
download | archweb-77a45dc7bc6f0badb45ec043e85f1b542c52792e.tar.gz archweb-77a45dc7bc6f0badb45ec043e85f1b542c52792e.tar.xz |
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 b2e75b2..3433616 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, |