diff options
author | Alban Gruin | 2017-01-23 09:11:30 +0100 |
---|---|---|
committer | Alban Gruin | 2017-01-23 09:11:30 +0100 |
commit | 1b4731f85718d77db343607e68570797b7e0aae7 (patch) | |
tree | 70ad61b696bda5ed2b0aa8d3031a85e8c8e713dd /views.py | |
parent | 22faec68b77a48681df12036713f44f9d8df7bfd (diff) |
Les semaines passées ne sont plus affichées dans la liste des emplois du temps disponibles
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -13,14 +13,19 @@ def index(request): timetables = Timetable.objects.all() groups = Group.objects.filter(tp__isnull=False).order_by("name") + current_year, current_week, _ = timezone.now().isocalendar() + for group in groups: courses = Course.objects.get_courses_for_group(group).values("begin").annotate(count=Count("begin")) weeks = [] for course in courses: year, week, _ = course["begin"].isocalendar() - date, _ = get_week(year, week) - if date not in weeks: - weeks.append(date) + + if year >= current_year and week >= current_week: + date, _ = get_week(year, week) + if date not in weeks: + weeks.append(date) + group.weeks = weeks return render(request, "index.html", {"timetables": timetables, "groups": groups}) |