Merge pull request #123 from pydata/unpublished-schedule

Don't show unpublished schedule info to non-staff.
This commit is contained in:
Patrick Altman 2016-02-20 17:03:26 -06:00
commit 73a087c801

View file

@ -69,6 +69,8 @@ def schedule_detail(request, slug=None):
def schedule_list(request, slug=None): def schedule_list(request, slug=None):
schedule = fetch_schedule(slug) schedule = fetch_schedule(slug)
if not schedule.published and not request.user.is_staff:
raise Http404()
presentations = Presentation.objects.filter(section=schedule.section) presentations = Presentation.objects.filter(section=schedule.section)
presentations = presentations.exclude(cancelled=True) presentations = presentations.exclude(cancelled=True)
@ -82,6 +84,8 @@ def schedule_list(request, slug=None):
def schedule_list_csv(request, slug=None): def schedule_list_csv(request, slug=None):
schedule = fetch_schedule(slug) schedule = fetch_schedule(slug)
if not schedule.published and not request.user.is_staff:
raise Http404()
presentations = Presentation.objects.filter(section=schedule.section) presentations = Presentation.objects.filter(section=schedule.section)
presentations = presentations.exclude(cancelled=True).order_by("id") presentations = presentations.exclude(cancelled=True).order_by("id")
@ -169,6 +173,8 @@ def schedule_presentation_detail(request, pk):
presentation = get_object_or_404(Presentation, pk=pk) presentation = get_object_or_404(Presentation, pk=pk)
if presentation.slot: if presentation.slot:
schedule = presentation.slot.day.schedule schedule = presentation.slot.day.schedule
if not schedule.published and not request.user.is_staff:
raise Http404()
else: else:
schedule = None schedule = None