From 7746a9546abbfdc0c574b957c917e70720ddb2bb Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Sun, 1 Sep 2019 20:18:04 +0200
Subject: [PATCH] Resolve circular dependency of code in tables.py by using
 annotations from Python 4.0.

---
 biscuit/apps/chronos/tables.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/biscuit/apps/chronos/tables.py b/biscuit/apps/chronos/tables.py
index 552da7bf..2492ca1f 100644
--- a/biscuit/apps/chronos/tables.py
+++ b/biscuit/apps/chronos/tables.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 from typing import Optional
 
 from django.utils.translation import ugettext_lazy as _
@@ -7,6 +9,13 @@ from django_tables2.utils import A
 from .models import LessonPeriod
 
 
+def _css_class_from_lesson_state(record: Optional[LessonPeriod] = None, table: Optional[LessonsTable] = None) -> str:
+    if record.get_substitution(table._week):
+        return 'table-warning'
+    else:
+        return ''
+
+
 class LessonsTable(tables.Table):
     class Meta:
         attrs = {'class': 'table table-striped table-bordered table-hover table-responsive-xl'}
@@ -22,10 +31,3 @@ class LessonsTable(tables.Table):
     def __init__(self, week, *args, **kwargs):
         self._week = week
         super().__init__(*args, **kwargs)
-
-
-def _css_class_from_lesson_state(record: Optional[LessonPeriod] = None, table: Optional[LessonTable] = None) -> str:
-    if record.get_substitution(table._week):
-        return 'table-warning'
-    else:
-        return ''
-- 
GitLab