Handle edge cases where a speaker has 0 events

This commit is contained in:
Thomas Steen Rasmussen 2020-08-04 00:22:43 +02:00
parent 1739297caf
commit 09cf137aac

View file

@ -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