diff options
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2,7 +2,7 @@ from django.http import HttpResponse from django.db.models import Count from django.shortcuts import get_object_or_404, render, render_to_response -from edt.models import Timetable, Group, Course +from edt.models import Timetable, LastUpdate, Group, Course from edt.utils import get_week import datetime @@ -28,7 +28,9 @@ def timetable(request, timetable_slug, year, week, group_slug): timetable = get_object_or_404(Timetable, slug=timetable_slug) group = get_object_or_404(Group, slug=group_slug, timetable=timetable) + courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end) + last_update = LastUpdate.objects.get(timetable=timetable, week=week, year=year) grouped_courses = [] for i, course in enumerate(courses): @@ -37,4 +39,4 @@ def timetable(request, timetable_slug, year, week, group_slug): else: grouped_courses[-1].append(course) - return render_to_response("timetable.html", {"timetable": timetable, "group": group, "courses": grouped_courses, "week": week}) + return render_to_response("timetable.html", {"timetable": timetable, "group": group, "courses": grouped_courses, "last_update": last_update.date, "week": week}) |