Skip to content
Snippets Groups Projects
Commit b83c6f86 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Fix listing of teachers and groups in lesson view. Advances #11, #12.

parent 8d6f34cc
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,14 @@ class Lesson(models.Model):
date_end = models.DateField(verbose_name=_(
'Effective end date of lesson'), null=True)
@property
def teacher_names(self, sep: Optional[str] = ', ') -> str:
return sep.join([teacher.name for teacher in self.teachers.all()])
@property
def group_names(self, sep: Optional[str] = ', ') -> str:
return sep.join([group.name for group in self.groups.all()])
class Meta:
ordering = ['date_start']
......
......@@ -7,7 +7,7 @@ class LessonsTable(tables.Table):
attrs = {'class': 'table table-striped table-bordered table-hover table-responsive-xl'}
period__period = tables.Column(accessor='period.period')
lesson__groups = tables.Column(accessor='lesson.groups')
lesson__teachers = tables.Column(accessor='lesson.teachers')
lesson__groups = tables.Column(accessor='lesson.group_names')
lesson__teachers = tables.Column(accessor='lesson.teacher_names')
lesson__subject = tables.Column(accessor='lesson.subject')
room = tables.Column(accessor='room')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment