From f520e791a6e1e1b67eb0e63ad84c10c2aa932f74 Mon Sep 17 00:00:00 2001 From: Guilherme Gondim Date: Fri, 12 Sep 2008 22:58:53 +0000 Subject: [PATCH] =?UTF-8?q?Corrigido=20ordena=C3=A7=C3=A3o=20de=20Alphabet?= =?UTF-8?q?icFilterSpec.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/admin/filterspecs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sigi/admin/filterspecs.py b/sigi/admin/filterspecs.py index 5e0ff4f..1d4959b 100644 --- a/sigi/admin/filterspecs.py +++ b/sigi/admin/filterspecs.py @@ -18,9 +18,10 @@ class AlphabeticFilterSpec(ChoicesFilterSpec): model_admin) self.lookup_kwarg = '%s__istartswith' % f.name self.lookup_val = request.GET.get(self.lookup_kwarg, None) - values_list = model.objects.values_list(f.name, flat=True).order_by(f.name) + values_list = model.objects.values_list(f.name, flat=True) # getting the first char of values - self.lookup_choices = set(val[0] for val in values_list) + self.lookup_choices = list(set(val[0] for val in values_list)) + self.lookup_choices.sort() def choices(self, cl): yield {'selected': self.lookup_val is None,