Adds chair() method to sessions so that templates can easily determine who the chair is.

This commit is contained in:
Christopher Neugebauer 2016-12-10 17:00:49 +11:00
parent b783901e98
commit 34e250322c

View file

@ -270,6 +270,12 @@ class Session(models.Model):
else: else:
return None return None
def chair(self):
for role in self.sessionrole_set.all():
if role.role == SessionRole.SESSION_ROLE_CHAIR:
return role
return None
def __str__(self): def __str__(self):
start = self.start() start = self.start()
end = self.end() end = self.end()