|
|
@ -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, |
|
|
|