diff options
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -18,12 +18,21 @@ from django.shortcuts import get_object_or_404, redirect, render from django.core.mail import send_mail from django.conf import settings from django.template import Context, loader +from django.db.models import Count from .forms import SubscribeForm from .models import Timetable, LastUpdate, Group, Subscription, Course from .utils import get_current_week, get_week, group_courses def index(request): + years = Timetable.objects.order_by("year").values("year").annotate(count=Count("year")) + return render(request, "index.html", {"years": years}) + +def mention_list(request, year): + timetables = Timetable.objects.order_by("name").filter(year=year) + return render(request, "mention_list.html", {"year": year, "timetables": timetables}) + +def timetables_list(request): timetables = Timetable.objects.order_by("name") groups = Group.objects.get_relevant_groups().order_by("name") @@ -44,7 +53,7 @@ def index(request): if hasattr(group, "weeks"): group.weeks.sort() - return render(request, "index.html", {"timetables": timetables, "groups": groups}) + return render(request, "timetables_list.html", {"timetables": timetables, "groups": groups}) def timetable(request, timetable_slug, group_slug, year=None, week=None): if year is None or week is None: |