Let Timeslot.session() Return the first session, rather than none, for

timeslots with multiple associated sessions for the public schedule.
 - Legacy-Id: 6464
This commit is contained in:
Henrik Levkowetz 2013-10-18 12:15:46 +00:00
parent 819b4c6087
commit 11230a8448

View file

@ -251,7 +251,7 @@ class TimeSlot(models.Model):
def session(self):
if not hasattr(self, "_session_cache"):
sessions = self.sessions.filter(scheduledsession__schedule=self.meeting.agenda)
self._session_cache = sessions.get() if sessions.count() == 1 else None
self._session_cache = sessions.all()[0] if sessions.count() else None
return self._session_cache
@property