diff options
author | Dan McGee <dan@archlinux.org> | 2010-09-23 18:15:00 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-09-24 19:39:37 -0500 |
commit | 1c6099f4b27f31c100b8bfa0d18f439075cceff0 (patch) | |
tree | 172405ceeba848ae2c6186febbbd164f6783c287 /mirrors | |
parent | 46dec163468f0e53b00b68f5c370b5e7b5e4cfc3 (diff) |
Make general mirror list view public
Hide some columns when not logged in because they aren't relevant for the
general public, but this will work nicely as a base page for all of our
known mirrors.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r-- | mirrors/models.py | 3 | ||||
-rw-r--r-- | mirrors/views.py | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/mirrors/models.py b/mirrors/models.py index 5cab9db6..d8d1a3e5 100644 --- a/mirrors/models.py +++ b/mirrors/models.py @@ -27,7 +27,8 @@ class Mirror(models.Model): return self.name def supported_protocols(self): - protocols = MirrorProtocol.objects.filter(urls__mirror=self).distinct() + protocols = MirrorProtocol.objects.filter( + urls__mirror=self).order_by('protocol').distinct() return ", ".join([p.protocol for p in protocols]) class MirrorProtocol(models.Model): diff --git a/mirrors/views.py b/mirrors/views.py index 5c157894..9380f810 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -70,6 +70,12 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False): }, mimetype='text/plain') +def mirrors(request): + mirrors = Mirror.objects.select_related().order_by('tier', 'country') + if not request.user.is_authenticated(): + mirrors = mirrors.filter(public=True, active=True) + return direct_to_template(request, 'mirrors/mirrors.html', + {'mirror_list': mirrors}) def status(request): bad_timedelta = datetime.timedelta(days=3) |