From 958bc6311392849d0bcbfe834dd95f2e49817ce8 Mon Sep 17 00:00:00 2001 From: Thayer Williams Date: Tue, 16 Mar 2010 11:19:58 -0700 Subject: Add alphabetical sorting to mirrorlists Also unify the sorting at the model-level for donors and remove the now duplicate sorting in the admin for mirrors. Signed-off-by: Dan McGee --- main/admin.py | 1 - main/models.py | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'main') diff --git a/main/admin.py b/main/admin.py index 0585e5c..ec10d9c 100644 --- a/main/admin.py +++ b/main/admin.py @@ -55,7 +55,6 @@ class MirrorAdmin(admin.ModelAdmin): form = MirrorAdminForm list_display = ('name', 'tier', 'country', 'active', 'public', 'isos', 'admin_email', 'supported_protocols') list_filter = ('tier', 'country', 'active', 'public') - ordering = ['country', 'name'] search_fields = ('name',) inlines = [ MirrorUrlInlineAdmin, diff --git a/main/models.py b/main/models.py index 1f938cc..8dc05a5 100644 --- a/main/models.py +++ b/main/models.py @@ -72,6 +72,10 @@ class Mirror(models.Model): rsync_user = models.CharField(max_length=50, blank=True, default='') rsync_password = models.CharField(max_length=50, blank=True, default='') notes = models.TextField(blank=True) + + class Meta: + ordering = ('country', 'name') + def __unicode__(self): return self.name @@ -106,10 +110,13 @@ class MirrorRsync(models.Model): class Donor(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=255, unique=True) + def __unicode__(self): return self.name + class Meta: db_table = 'donors' + ordering = ['name'] class News(models.Model): id = models.AutoField(primary_key=True) -- cgit v1.2.3-24-g4f1b