slightly better group sort

This commit is contained in:
j 2023-07-06 17:32:05 +05:30
parent 028def73d9
commit bd9d2ecd7e

View file

@ -79,7 +79,9 @@ class SessionData(models.Model):
self.level = self.user.profile.level self.level = self.user.profile.level
self.firstseen = self.user.date_joined self.firstseen = self.user.date_joined
if self.user.groups.exists(): if self.user.groups.exists():
self.groupssort = ''.join([g.name for g in self.user.groups.all()]) self.groupsort = ''.join(
ox.sorted_strings(self.user.groups.all().values_list('name', flat=True))
).lower()
else: else:
self.groupssort = None self.groupssort = None
self.numberoflists = self.user.lists.count() self.numberoflists = self.user.lists.count()