Skip to content
Snippets Groups Projects

WIP: Add way to edit substitution

Merged Tom Teichler requested to merge issue12 into master
1 file
+ 5
3
Compare changes
  • Side-by-side
  • Inline
 
from typing import Optional
 
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _
import django_tables2 as tables
import django_tables2 as tables
from django_tables2.utils import A
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:
def _css_class_from_lesson_state(record: Optional[LessonPeriod] = None, table: Optional[LessonTable] = None) -> str:
if record.get_substitution(table._week):
if record.get_substitution(table._week):
@@ -13,6 +17,7 @@ def _css_class_from_lesson_state(record: Optional[LessonPeriod] = None, table: O
@@ -13,6 +17,7 @@ def _css_class_from_lesson_state(record: Optional[LessonPeriod] = None, table: O
class LessonsTable(tables.Table):
class LessonsTable(tables.Table):
class Meta:
class Meta:
attrs = {'class': 'table table-striped table-bordered table-hover table-responsive-xl'}
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')
period__period = tables.Column(accessor='period.period')
lesson__groups = tables.Column(accessor='lesson.group_names')
lesson__groups = tables.Column(accessor='lesson.group_names')
@@ -23,6 +28,3 @@ class LessonsTable(tables.Table):
@@ -23,6 +28,3 @@ class LessonsTable(tables.Table):
def __init__(self, week, *args, **kwargs):
def __init__(self, week, *args, **kwargs):
self._week = week
self._week = week
super().__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
class Meta:
row_attrs = {'class': _css_class_from_lesson_state}
Loading