From 09cf137aac560826a5df5ff39a5fbd47228d215c Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Tue, 4 Aug 2020 00:22:43 +0200 Subject: [PATCH] Handle edge cases where a speaker has 0 events --- src/program/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/program/models.py b/src/program/models.py index ea91418d..3b16063a 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -478,8 +478,8 @@ class SpeakerProposal(UserSubmittedModel): @property def title(self): """ Convenience method to return the proper host_title """ - if self.event_proposals.values_list("event_type").distinct().count() > 1: - # we have different eventtypes, use generic title + if self.event_proposals.values_list("event_type").distinct().count() != 1: + # we have no events, or events of different eventtypes, use generic title return "Person" else: return self.event_proposals.first().event_type.host_title