summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-25 01:32:57 -0500
committerDan McGee <dan@archlinux.org>2012-04-25 01:51:58 -0500
commit640e0f58645a7fd07f3c6185d9583b4d218e2468 (patch)
tree46323cbe3549b7d60a7b88eacb702522982b2a27 /public
parent20675141c340ea3d2d6d8305f8ba0950d3bf974c (diff)
downloadarchweb-640e0f58645a7fd07f3c6185d9583b4d218e2468.tar.gz
archweb-640e0f58645a7fd07f3c6185d9583b4d218e2468.zip
Finish django countries implementation
* Add a migration to drop the old countries field. * Update all templates/views/utility methods to point at the new country field and dereference it as necessary. * Add the flags images to a few views where it makes sense. * Cleanup the download page layout quite a bit. * Bump the mirror status JSON version to 3; add country_code attribute. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'public')
-rw-r--r--public/views.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/public/views.py b/public/views.py
index e149d921..3ea8f841 100644
--- a/public/views.py
+++ b/public/views.py
@@ -1,11 +1,11 @@
from datetime import datetime
+from operator import attrgetter
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models import Count, Q
from django.http import Http404
from django.views.decorators.cache import cache_control
-from django.views.generic import list_detail
from django.views.generic.simple import direct_to_template
from devel.models import MasterKey, PGPSignature
@@ -66,19 +66,17 @@ def donate(request):
@cache_control(max_age=300)
def download(request):
- qset = MirrorUrl.objects.select_related('mirror', 'protocol').filter(
- protocol__is_download=True,
- mirror__public=True, mirror__active=True, mirror__isos=True
- )
+ mirror_urls = MirrorUrl.objects.select_related('mirror').filter(
+ protocol__default=True,
+ mirror__public=True, mirror__active=True, mirror__isos=True)
+ sort_by = attrgetter('real_country.name', 'mirror.name')
+ mirror_urls = sorted(mirror_urls, key=sort_by)
context = {
'releng_iso_url': settings.ISO_LIST_URL,
'releng_pxeboot_url': settings.PXEBOOT_URL,
+ 'mirror_urls': mirror_urls,
}
- return list_detail.object_list(request,
- qset.order_by('mirror__country_old', 'mirror__name', 'protocol'),
- template_name="public/download.html",
- template_object_name="mirror_url",
- extra_context=context)
+ return direct_to_template(request, 'public/download.html', context)
@cache_control(max_age=300)
def feeds(request):