aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'views.py')
-rw-r--r--views.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/views.py b/views.py
index 66f0a03..442ada6 100644
--- a/views.py
+++ b/views.py
@@ -55,8 +55,13 @@ def group_list(request, year_slug, timetable_slug):
return render(request, "group_list.html", {"timetable": timetable, "groups": groups})
def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=None):
+ current_year, current_week = get_current_week()
+ is_old_timetable = False
+
if year is None or week is None:
- year, week = get_current_week()
+ year, week = current_year, current_week
+ elif (int(year), int(week)) < (current_year, current_week):
+ is_old_timetable = True
start, end = get_week(int(year), int(week))
@@ -69,7 +74,10 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No
grouped_courses = group_courses(courses)
- return render(request, "timetable.html", {"group": group, "courses": grouped_courses, "last_update": courses.first().last_update__max, "year": year, "week": int(week)})
+ return render(request, "timetable.html", {"group": group, "courses": grouped_courses,
+ "last_update": courses.first().last_update__max,
+ "year": year, "week": int(week),
+ "is_old_timetable": is_old_timetable})
def contact(request):
return render(request, "contact.html", {"email": settings.ADMINS[0][1]})