示例#1
0
def schedule_edit(request, slug=None):

    if not request.user.is_staff:
        raise Http404()

    schedule = fetch_schedule(slug)

    if request.method == "POST":
        form = ScheduleSectionForm(
            request.POST, request.FILES, schedule=schedule
        )
        if form.is_valid():
            if 'submit' in form.data:
                msg = form.build_schedule()
            elif 'delete' in form.data:
                msg = form.delete_schedule()
            messages.add_message(request, msg[0], msg[1])
    else:
        form = ScheduleSectionForm(schedule=schedule)
    days_qs = Day.objects.filter(schedule=schedule)
    days = [TimeTable(day) for day in days_qs]
    ctx = {
        "schedule": schedule,
        "days": days,
        "form": form
    }
    return render(request, "symposion/schedule/schedule_edit.html", ctx)
示例#2
0
文件: views.py 项目: Diwahars/pycon
def schedule_conference(request):
    days = Day.objects.filter(schedule__published=True)
    days = days.select_related('schedule')
    days = days.prefetch_related('schedule__section')
    days = days.order_by('date')
    timetables = [TimeTable(day) for day in days]
    return render(request, "schedule/schedule_conference.html", {
        "timetables": timetables,
    })
示例#3
0
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]

    ctx = {"schedule": schedule, "days": days}
    return render(request, "symposion/schedule/schedule_detail.html", ctx)
示例#4
0
def schedule_edit(request, slug=None):

    if not request.user.is_staff:
        raise Http404()

    schedule = fetch_schedule(slug)

    days_qs = Day.objects.filter(schedule=schedule)
    days = [TimeTable(day) for day in days_qs]
    ctx = {
        "schedule": schedule,
        "days": days,
    }
    return render(request, "schedule/schedule_edit.html", ctx)
示例#5
0
文件: views.py 项目: Diwahars/pycon
def schedule_detail(request, slug=None):
    schedule = fetch_schedule(slug)
    if not schedule.published and not request.user.is_staff:
        raise Http404()

    days = Day.objects.filter(schedule=schedule)
    days = days.select_related('schedule')
    days = days.prefetch_related('schedule__section')
    days = days.order_by('date')
    timetables = [TimeTable(day) for day in days]

    return render(request, "schedule/schedule_detail.html", {
        "schedule": schedule,
        "timetables": timetables,
    })
示例#6
0
def schedule_conference(request):

    schedules = Schedule.objects.filter(published=True, hidden=False)

    sections = []
    for schedule in schedules:
        days_qs = Day.objects.filter(schedule=schedule)
        days = [TimeTable(day) for day in days_qs]
        sections.append({
            "schedule": schedule,
            "days": days,
        })

    ctx = {
        "sections": sections,
    }
    return render(request, "schedule/schedule_conference.html", ctx)
示例#7
0
def schedule_conference(request):

    if request.user.is_staff:
        schedules = Schedule.objects.filter(hidden=False)
    else:
        schedules = Schedule.objects.filter(published=True, hidden=False)

    # Sort schedules by their first day.
    schedules = sorted(schedules, key=lambda s: s.first_date())

    sections = []
    for schedule in schedules:
        days_qs = Day.objects.filter(schedule=schedule)
        days = [TimeTable(day) for day in days_qs]
        sections.append({"schedule": schedule, "days": days})

    ctx = {"sections": sections}
    return render(request, "symposion/schedule/schedule_conference.html", ctx)
示例#8
0
def schedule_conference(request):

    if request.user.is_staff:
        schedules = Schedule.objects.filter(hidden=False)
    else:
        schedules = Schedule.objects.filter(published=True, hidden=False)

    sections = []
    for schedule in schedules:
        days_qs = Day.objects.filter(schedule=schedule)
        days = [TimeTable(day) for day in days_qs]
        sections.append({
            "schedule": schedule,
            "days": days,
        })

    day_switch = request.GET.get('day', None)
    ctx = {
        "sections": sections,
        "day_switch": day_switch
    }
    return render(request, "symposion/schedule/schedule_conference.html", ctx)