From 57ffdbf0658042069abcf0b1f9184ff69a3139e2 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Fri, 8 Sep 2017 11:53:49 +0200 Subject: Ajout de l’année dans les urls --- feeds.py | 7 ++++--- templates/group_list.html | 2 +- templates/subscribe.html | 2 +- templates/timetable.html | 2 +- urls.py | 8 ++++---- views.py | 14 ++++++++------ 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/feeds.py b/feeds.py index ca1c843..e2b0b3f 100644 --- a/feeds.py +++ b/feeds.py @@ -19,7 +19,7 @@ from django.utils.feedgenerator import SyndicationFeed from icalendar import Calendar, Event -from .models import Course, Group, Timetable +from .models import Course, Group, Timetable, Year from .templatetags.rooms import format_rooms ICAL_NAMES = ["summary", "description", "location", "start", "dtstart", "dtend"] @@ -48,9 +48,10 @@ class IcalFeed(Feed): feed_type = IcalFeedGenerator link = "" - def get_object(self, request, timetable_slug, group_slug): + def get_object(self, request, year_slug, timetable_slug, group_slug): try: - timetable = Timetable.objects.get(slug=timetable_slug) + year = Year.objects.get(slug=year_slug) + timetable = Timetable.objects.get(year=year, slug=timetable_slug) group = Group.objects.get(timetable=timetable, slug=group_slug) except: raise ObjectDoesNotExist diff --git a/templates/group_list.html b/templates/group_list.html index d8d7227..2530865 100644 --- a/templates/group_list.html +++ b/templates/group_list.html @@ -5,7 +5,7 @@