diff options
author | Alban Gruin | 2017-01-22 14:34:14 +0100 |
---|---|---|
committer | Alban Gruin | 2017-01-22 14:34:14 +0100 |
commit | c35a975116bd1a478b7d09028ffba662796d8890 (patch) | |
tree | d232632a2dd3f276a7913768d8430a017c8a2fa3 /views.py | |
parent | 310c91fcd777a9e7c97379803e41d795a4661be7 (diff) |
Affichage de la dernière mise à jour sur les pages concernées
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}) |