groupssort should be None if there are no groups

This commit is contained in:
j 2013-09-15 12:13:20 +00:00
parent 14674f07a6
commit 99e0929100

View file

@ -88,7 +88,10 @@ class SessionData(models.Model):
self.username = self.user.username self.username = self.user.username
self.level = self.user.get_profile().level self.level = self.user.get_profile().level
self.firstseen = self.user.date_joined self.firstseen = self.user.date_joined
if self.user.groups.exists():
self.groupssort = ''.join([g.name for g in self.user.groups.all()]) self.groupssort = ''.join([g.name for g in self.user.groups.all()])
else:
self.groupssort = None
self.numberoflists = self.user.lists.count() self.numberoflists = self.user.lists.count()
else: else:
self.groupssort = None self.groupssort = None