def ethnic_groups(self): "Return the ethnic groups of the items" groups = [] items = self.items.all() for item in items: if item.ethnic_group and not item.ethnic_group in groups: groups.append(item.ethnic_group) cmp = lambda a, b: unaccent_icmp(a.value, b.value) groups.sort(cmp) return groups
def __name_cmp(obj1, obj2): return unaccent_icmp(obj1.name, obj2.name)