2012-08-30 06:21:48 +00:00
|
|
|
from django.shortcuts import render, get_object_or_404
|
|
|
|
|
|
|
|
from symposion.schedule.models import Schedule
|
|
|
|
|
|
|
|
|
|
|
|
def schedule_detail(request, slug=None):
|
|
|
|
qs = Schedule.objects.all()
|
2012-08-30 06:23:49 +00:00
|
|
|
if slug is None:
|
2012-08-30 06:21:48 +00:00
|
|
|
schedule = next(iter(qs), None)
|
|
|
|
if schedule is None:
|
|
|
|
raise Http404()
|
|
|
|
else:
|
|
|
|
schedule = get_object_or_404(qs, slug=slug)
|
|
|
|
ctx = {
|
|
|
|
"schedule": schedule,
|
|
|
|
}
|
|
|
|
return render(request, "schedule/schedule_detail.html")
|
|
|
|
|
|
|
|
|
|
|
|
def schedule_edit(request, slug=None):
|
|
|
|
qs = Schedule.objects.all()
|
2012-08-30 06:23:49 +00:00
|
|
|
if slug is None:
|
2012-08-30 06:21:48 +00:00
|
|
|
schedule = next(iter(qs), None)
|
|
|
|
if schedule is None:
|
|
|
|
raise Http404()
|
|
|
|
else:
|
|
|
|
schedule = get_object_or_404(qs, slug=slug)
|
2012-08-30 06:51:07 +00:00
|
|
|
days_qs = Day.objects.filter(schedule=schedule)
|
|
|
|
days = [TimeTable(day) for day in days_qs]
|
2012-08-30 06:21:48 +00:00
|
|
|
ctx = {
|
|
|
|
"schedule": schedule,
|
2012-08-30 06:51:07 +00:00
|
|
|
"days": days,
|
2012-08-30 06:21:48 +00:00
|
|
|
}
|
|
|
|
return render(request, "schedule/schedule_edit.html")
|