diff options
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]}) |