aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
authorAlban Gruin2017-10-29 15:37:43 +0100
committerAlban Gruin2017-10-29 15:37:43 +0100
commitc80a41ffafe3065f35f07b71063b5596d33d0ff2 (patch)
treedfe357fe9ce314460fa0d9312f3f0bcdd419862e /views.py
parentf0790a2420684a39e2b48922beec1245f4446912 (diff)
Déplacement de tous les liens vers les ICS dans une page spéciale
Diffstat (limited to 'views.py')
-rw-r--r--views.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/views.py b/views.py
index 9c38524..7c19840 100644
--- a/views.py
+++ b/views.py
@@ -17,6 +17,7 @@ import datetime
from django.conf import settings
from django.db.models import Max
+from django.db.models.functions import Length
from django.http import Http404
from django.shortcuts import get_object_or_404, render
@@ -95,5 +96,13 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No
"year": year, "week": int(week),
"is_old_timetable": is_old_timetable})
+def calendars(request, year_slug, timetable_slug, group_slug):
+ group = get_object_or_404(Group, timetable__year__slug=year_slug,
+ timetable__slug=timetable_slug, slug=group_slug)
+ groups = Group.objects.get_parents(group).annotate(length=Length("subgroup")) \
+ .order_by("length")
+
+ return render(request, "calendars.html", {"group": group, "groups": groups})
+
def contact(request):
return render(request, "contact.html", {"email": settings.ADMINS[0][1]})