From c7592bc33e2626d84ec46fe1e7ba8e05c73ef74c Mon Sep 17 00:00:00 2001 From: Luke Hatcher Date: Tue, 29 Jan 2013 03:13:41 -0500 Subject: [PATCH] add published and hidden attributes to schedules --- symposion/schedule/models.py | 2 ++ symposion/schedule/views.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/symposion/schedule/models.py b/symposion/schedule/models.py index fdafd85f..dc070917 100644 --- a/symposion/schedule/models.py +++ b/symposion/schedule/models.py @@ -11,6 +11,8 @@ from symposion.conference.models import Section class Schedule(models.Model): section = models.OneToOneField(Section) + published = models.BooleanField(default=True) + hidden = models.BooleanField("Hide schedule from overall conference view", default=False) def __unicode__(self): return "%s Schedule" % self.section diff --git a/symposion/schedule/views.py b/symposion/schedule/views.py index e9140cbb..35f9e432 100644 --- a/symposion/schedule/views.py +++ b/symposion/schedule/views.py @@ -27,7 +27,7 @@ def fetch_schedule(slug): def schedule_conference(request): - schedules = Schedule.objects.all() + schedules = Schedule.objects.filter(published=True, hidden=False) sections = [] for schedule in schedules: @@ -47,6 +47,8 @@ def schedule_conference(request): def schedule_detail(request, slug=None): schedule = fetch_schedule(slug) + if not schedule.published and not request.user.is_staff: + raise Http404() days_qs = Day.objects.filter(schedule=schedule) days = [TimeTable(day) for day in days_qs]