Fix presentation detail

Do not retrieve schedule if it does not exist for proposal kind section.
Do not show slot information if slot is not assigned.
This commit is contained in:
Joel Addison 2019-12-15 16:02:44 +10:00
parent eb1193b265
commit bc0f49f391
2 changed files with 11 additions and 2 deletions

View file

@ -8,7 +8,13 @@
{% block head_title %}Presentation: {{ presentation.title }}{% endblock %} {% block head_title %}Presentation: {{ presentation.title }}{% endblock %}
{% block page_title %}{{ presentation.title }}{% endblock %} {% block page_title %}{{ presentation.title }}{% endblock %}
{% block page_lead %}{{ presentation.slot.rooms.0 }} | {{ presentation.slot.day.date|date:"D d M" }} | {{ presentation.slot.start}}–{{ presentation.slot.end }}{% endblock %} {% block page_lead %}
{% if presentation.slot %}
{{ presentation.slot.rooms.0 }} | {{ presentation.slot.day.date|date:"D d M" }} | {{ presentation.slot.start }}–{{ presentation.slot.end }}
{% else %}
<em>Not currently scheduled.</em>
{% endif %}
{% endblock %}
{% block content %} {% block content %}
{% if presentation.unpublish %} {% if presentation.unpublish %}

View file

@ -186,12 +186,15 @@ def schedule_presentation_detail(request, pk):
presentation = get_object_or_404(Presentation, pk=pk) presentation = get_object_or_404(Presentation, pk=pk)
schedule = None
if presentation.slot: if presentation.slot:
# 1) Schedule from presentation's slot # 1) Schedule from presentation's slot
schedule = presentation.slot.day.schedule schedule = presentation.slot.day.schedule
else: else:
# 2) Fall back to the schedule for this proposal # 2) Fall back to the schedule for this proposal
schedule = presentation.proposal.kind.section.schedule section = presentation.proposal.kind.section
if hasattr(section, 'schedule'):
schedule = presentation.proposal.kind.section.schedule
if not request.user.is_staff: if not request.user.is_staff:
# 3) Is proposal unpublished? # 3) Is proposal unpublished?