From 116751e4bab183b3cca93ab13f7f4f21c752be4e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 24 Apr 2012 23:22:23 -0500 Subject: Rename mirror country fields to country_old in prep for normalization We're going to move to using ISO 2 character codes via django countries, so start by moving the old data out of the way first. Signed-off-by: Dan McGee --- mirrors/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mirrors/views.py') diff --git a/mirrors/views.py b/mirrors/views.py index e93097a..c5989d6 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -23,7 +23,7 @@ class MirrorlistForm(forms.Form): def __init__(self, *args, **kwargs): super(MirrorlistForm, self).__init__(*args, **kwargs) countries = Mirror.objects.filter(active=True).values_list( - 'country', flat=True).distinct().order_by('country') + 'country_old', flat=True).distinct().order_by('country_old') self.fields['country'].choices = [('all','All')] + make_choice( countries) self.fields['country'].initial = ['all'] @@ -62,8 +62,8 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False, mirror__public=True, mirror__active=True, ) if countries and 'all' not in countries: - qset = qset.filter(Q(country__in=countries) | - Q(mirror__country__in=countries)) + qset = qset.filter(Q(country_old__in=countries) | + Q(mirror__country_old__in=countries)) ip_version = Q() if ipv4_supported: @@ -97,7 +97,7 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False, mimetype='text/plain') def mirrors(request): - mirror_list = Mirror.objects.select_related().order_by('tier', 'country') + mirror_list = Mirror.objects.select_related().order_by('tier', 'country_old') if not request.user.is_authenticated(): mirror_list = mirror_list.filter(public=True, active=True) return direct_to_template(request, 'mirrors/mirrors.html', -- cgit v1.2.3-24-g4f1b