From da1012c30112ed880af3506c5aa1a48d43db83a4 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Sat, 31 Aug 2019 22:19:34 +0200 Subject: [PATCH] Pass week number into lessons tbale. Advances #12. --- biscuit/apps/chronos/tables.py | 4 ++++ biscuit/apps/chronos/views.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/biscuit/apps/chronos/tables.py b/biscuit/apps/chronos/tables.py index 2be4f609..7b5968b8 100644 --- a/biscuit/apps/chronos/tables.py +++ b/biscuit/apps/chronos/tables.py @@ -11,3 +11,7 @@ class LessonsTable(tables.Table): lesson__teachers = tables.Column(accessor='lesson.teacher_names') lesson__subject = tables.Column(accessor='lesson.subject') room = tables.Column(accessor='room') + + def __init__(self, week, *args, **kwargs): + self._week = week + super().__init__(*args, **kwargs) diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py index 4a16f560..7aa1e359 100644 --- a/biscuit/apps/chronos/views.py +++ b/biscuit/apps/chronos/views.py @@ -102,7 +102,7 @@ def lessons_day(request: HttpRequest, when: Optional[str] = None) -> HttpRespons ).all() # Build table - lessons_table = LessonsTable(lesson_periods) + lessons_table = LessonsTable(week, lesson_periods) RequestConfig(request).configure(lessons_table) context['lessons_table'] = lessons_table -- GitLab