aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
authorAlban Gruin2017-01-22 14:34:14 +0100
committerAlban Gruin2017-01-22 14:34:14 +0100
commitc35a975116bd1a478b7d09028ffba662796d8890 (patch)
treed232632a2dd3f276a7913768d8430a017c8a2fa3 /views.py
parent310c91fcd777a9e7c97379803e41d795a4661be7 (diff)
Affichage de la dernière mise à jour sur les pages concernées
Diffstat (limited to 'views.py')
-rw-r--r--views.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/views.py b/views.py
index b971dc5..a6dfede 100644
--- a/views.py
+++ b/views.py
@@ -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})