Example #1
0
def schedule_day_from_date(request, day_start):
    """The day-at-a-glance schedule view, with the day specfied by
    a date object (including the start time of the schedule).

    """
    this_year, this_week, this_day = day_start.isocalendar()

    next_start = day_start + timedelta(days=1)
    next_year, next_week, next_day = next_start.isocalendar()

    prev_start = day_start - timedelta(days=1)
    prev_year, prev_week, prev_day = prev_start.isocalendar()

    term = Term.of(day_start)
    schedule = None if not term else ScheduleRange.day(
        day_start,
        exclude_before_start=False,
        exclude_after_end=False,
        exclude_subsuming=False,
        with_filler_timeslots=True).data

    return render(
        request,
        'schedule/schedule-day.html',
        {'day_start': day_start,
            'this_year': this_year,
            'this_week': this_week,
            'next_start': next_start,
            'next_year': next_year,
            'next_week': next_week,
            'next_day': next_day,
            'prev_start': prev_start,
            'prev_year': prev_year,
            'prev_week': prev_week,
            'prev_day': prev_day,
            'term': term,
            'schedule': schedule})