add published and hidden attributes to schedules

This commit is contained in:
Luke Hatcher 2013-01-29 03:13:41 -05:00
parent a4d94594af
commit c7592bc33e
2 changed files with 5 additions and 1 deletions

View file

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

View file

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