aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'views.py')
-rw-r--r--views.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/views.py b/views.py
index ffed2cc..2101a21 100644
--- a/views.py
+++ b/views.py
@@ -33,8 +33,7 @@ def mention_list(request, year_slug):
return render(request, "mention_list.html", {"year": year, "timetables": timetables})
def group_list(request, year_slug, timetable_slug):
- year_obj = get_object_or_404(Year, slug=year_slug)
- timetable = get_object_or_404(Timetable, year=year_obj, slug=timetable_slug)
+ timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_slug)
groups = Group.objects.get_relevant_groups(timetable=timetable).order_by("name")
year, week = get_current_week()
@@ -62,8 +61,7 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No
start, end = get_week(int(year), int(week))
- get_object_or_404(Year, slug=year_slug)
- timetable = get_object_or_404(Timetable, slug=timetable_slug)
+ timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_slug)
group = get_object_or_404(Group, slug=group_slug, timetable=timetable)
last_update = get_object_or_404(LastUpdate, timetable=timetable, week=week, year=year)
courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end)
@@ -73,9 +71,7 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No
return render(request, "timetable.html", {"group": group, "courses": grouped_courses, "last_update": last_update.date, "year": year, "week": int(week)})
def subscribe(request, year_slug, timetable_slug, group_slug, year, week):
- year_obj = get_object_or_404(Year, slug=year_slug)
- timetable = get_object_or_404(Timetable, year=year_obj, slug=timetable_slug)
- group = get_object_or_404(Group, slug=group_slug, timetable=timetable)
+ group = get_object_or_404(Group, slug=group_slug, timetable__slug=timetable_slug, timetable__year__slug=year_slug)
if request.method == "POST":
form = SubscribeForm(request.POST)