diff options
author | Alban Gruin | 2017-11-03 18:09:41 +0100 |
---|---|---|
committer | Alban Gruin | 2017-11-03 18:09:41 +0100 |
commit | 959bbaa5170aea4a9600d774280d44fc5107fdae (patch) | |
tree | aba0b535096b0ae6fa75ed243fb5374df8ed73fb /views.py | |
parent | 1edd7f6b2431095b27fd98205bb2ce5f462183e9 (diff) | |
parent | 5082e2aa0083a1c78cd39e86cb141786c2ab6efe (diff) |
Merge branch 'fusion/alban'
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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]}) |