Handle slots with no Proposal

* Use the item kind for a title if there's no proposal
* Use the content_override for the description if there's no proposal
This commit is contained in:
James Polley 2017-01-12 16:49:07 +11:00
parent 710d377016
commit 3d626e8420

View file

@ -276,17 +276,18 @@ class EventFeed(ICalFeed):
def item_title(self, item): def item_title(self, item):
if hasattr(item.content, 'proposal'): if hasattr(item.content, 'proposal'):
return item.content.title title = item.content.title
else: else:
item.content_override if item.content_override else "Slot" title = item.kind if item.kind else "Slot"
return title
def item_description(self, item): def item_description(self, item):
if hasattr(item.content, 'proposal'): if hasattr(item.content, 'proposal'):
description = "Speaker: %s\n%s" % ( description = "Speaker: %s\n%s" % (
item.content.speaker, item.content.abstract) item.content.speaker, item.content.abstract)
return description
else: else:
return None description = item.content_override if item.content_override else "No description"
return description
def item_start_datetime(self, item): def item_start_datetime(self, item):
return pytz.timezone(settings.TIME_ZONE).localize(item.start_datetime) return pytz.timezone(settings.TIME_ZONE).localize(item.start_datetime)