Commit ee2524c0 authored by okhin's avatar okhin 🚴

Sorting the groups is a better idea

parent 760306f4
......@@ -15,7 +15,7 @@ class ContactFilterByGroup(admin.SimpleListFilter):
user_orgs = [ x.id for x in request.user.organizations.all() ]
contacts = Contact.objects.filter(group__type__organization__in=user_orgs).values_list('groups__id', 'groups__name')
return ((g[0], g[1],) for g in set(contacts))
return ((g[0], g[1],) for g in sorted(set(contacts), key=lambda g: g[1]))
def queryset(self, request, queryset):
# self.value has the groyp id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment