summaryrefslogtreecommitdiff
path: root/mirrors/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-05-31 19:21:47 -0500
committerDan McGee <dan@archlinux.org>2013-05-31 19:21:47 -0500
commite50471b9a7658f37b00aa3854d75a45007926802 (patch)
treeef31774ad11960b590dffa59c5bcf4d78c50c0dc /mirrors/views.py
parentbbeb9276051c2dc34f6d63fac4963343aacdf9b2 (diff)
Honor mirror URL active attribute in several places
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/views.py')
-rw-r--r--mirrors/views.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index 22eb57b8..91cf6750 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -40,10 +40,13 @@ class MirrorlistForm(forms.Form):
fields['protocol'].choices = protos
fields['protocol'].initial = [p.protocol for p in initial]
fields['ip_version'].initial = ['4']
+ locations = [(l.id, l.source_ip) for l in
+ CheckLocation.objects.all()]
+ fields['check_location'].choices = locations
def get_countries(self):
country_codes = set()
- country_codes.update(MirrorUrl.objects.filter(
+ country_codes.update(MirrorUrl.objects.filter(active=True,
mirror__active=True).exclude(country='').values_list(
'country', flat=True).order_by().distinct())
countries = [(code, self.countries[code]) for code in country_codes]
@@ -102,7 +105,7 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False,
else:
protocols = MirrorProtocol.objects.filter(protocol__in=protocols)
qset = MirrorUrl.objects.select_related().filter(
- protocol__in=protocols,
+ protocol__in=protocols, active=True,
mirror__public=True, mirror__active=True)
if countries and 'all' not in countries:
qset = qset.filter(country__in=countries)