From 5f0fe414a714a5d4315c96f77f640169f6bccae4 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Sat, 31 Aug 2019 22:52:32 +0200 Subject: [PATCH] Fix missing imports and duplicate Meta class. --- biscuit/apps/chronos/tables.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/biscuit/apps/chronos/tables.py b/biscuit/apps/chronos/tables.py index e48e9c4f..5836ffa7 100644 --- a/biscuit/apps/chronos/tables.py +++ b/biscuit/apps/chronos/tables.py @@ -1,7 +1,11 @@ +from typing import Optional + from django.utils.translation import ugettext_lazy as _ import django_tables2 as tables from django_tables2.utils import A +from .models import LessonPeriod + def _css_class_from_lesson_state(record: Optional[LessonPeriod] = None, table: Optional[LessonTable] = None) -> str: if record.get_substitution(table._week): @@ -13,6 +17,7 @@ def _css_class_from_lesson_state(record: Optional[LessonPeriod] = None, table: O class LessonsTable(tables.Table): class Meta: attrs = {'class': 'table table-striped table-bordered table-hover table-responsive-xl'} + row_attrs = {'class': _css_class_from_lesson_state} period__period = tables.Column(accessor='period.period') lesson__groups = tables.Column(accessor='lesson.group_names') @@ -23,6 +28,3 @@ class LessonsTable(tables.Table): def __init__(self, week, *args, **kwargs): self._week = week super().__init__(*args, **kwargs) - - class Meta: - row_attrs = {'class': _css_class_from_lesson_state} -- GitLab