aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
authorAlban Gruin2017-11-03 18:09:41 +0100
committerAlban Gruin2017-11-03 18:09:41 +0100
commit959bbaa5170aea4a9600d774280d44fc5107fdae (patch)
treeaba0b535096b0ae6fa75ed243fb5374df8ed73fb /views.py
parent1edd7f6b2431095b27fd98205bb2ce5f462183e9 (diff)
parent5082e2aa0083a1c78cd39e86cb141786c2ab6efe (diff)
Merge branch 'fusion/alban'
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]})