diff --git a/biscuit/apps/chronos/tables.py b/biscuit/apps/chronos/tables.py index 38625021bd694e5b2a353a67fa8ef05c1b4939b4..e7f53f84336bc4f55ce1a44d061558b70369cce9 100644 --- a/biscuit/apps/chronos/tables.py +++ b/biscuit/apps/chronos/tables.py @@ -26,8 +26,4 @@ class LessonsTable(tables.Table): lesson__teachers = tables.Column(accessor='lesson.teacher_names', verbose_name=_('Teachers')) lesson__subject = tables.Column(accessor='lesson.subject') room = tables.Column(accessor='room') - edit_substitution = tables.LinkColumn('edit_substitution_by_id', args=[A('id')], text=_('Substitution')) - - def __init__(self, week, *args, **kwargs): - self.edit_substitution.args.append(week) - super().__init__(*args, **kwargs) + edit_substitution = tables.LinkColumn('edit_substitution_by_id', args=[A('id'), A('week')], text=_('Substitution')) diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py index bbb56809e9d507c0dd93279effcbdb254cf5b424..455d06d2a6e7aaf1ee277eb7fac4543915999466 100644 --- a/biscuit/apps/chronos/views.py +++ b/biscuit/apps/chronos/views.py @@ -99,10 +99,10 @@ def lessons_day(request: HttpRequest, when: Optional[str] = None) -> HttpRespons lesson_periods = LessonPeriod.objects.filter( lesson__date_start__lte=day, lesson__date_end__gte=day, period__weekday=weekday - ).all() + ).annotate(_week=week).all() # Build table - lessons_table = LessonsTable(week, lesson_periods) + lessons_table = LessonsTable(lesson_periods) RequestConfig(request).configure(lessons_table) context['lessons_table'] = lessons_table