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

Remove SchoolRelated and all related uses

Advances BiscuIT-ng#115.
parent a52358af
No related branches found
No related tags found
No related merge requests found
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from biscuit.core.mixins import SchoolRelated from biscuit.core.mixins import CRUDMixin
def isidentifier(value: str) -> bool: def isidentifier(value: str) -> bool:
return value.isidentifier() return value.isidentifier()
class PersonalNote(SchoolRelated): class PersonalNote(models.Model):
""" A personal note about a single person. Used in the class register to note """ A personal note about a single person. Used in the class register to note
absences, excuses and remarks about a student in a single lesson period. absences, excuses and remarks about a student in a single lesson period.
""" """
...@@ -25,12 +25,12 @@ class PersonalNote(SchoolRelated): ...@@ -25,12 +25,12 @@ class PersonalNote(SchoolRelated):
remarks = models.CharField(max_length=200, blank=True) remarks = models.CharField(max_length=200, blank=True)
class Meta: class Meta:
unique_together = [['school', 'lesson_period', 'week', 'person']] unique_together = [['lesson_period', 'week', 'person']]
ordering = ['lesson_period__lesson__date_start', 'week', 'lesson_period__period__weekday', ordering = ['lesson_period__lesson__date_start', 'week', 'lesson_period__period__weekday',
'lesson_period__period__period', 'person__last_name', 'person__first_name'] 'lesson_period__period__period', 'person__last_name', 'person__first_name']
class LessonDocumentation(SchoolRelated): class LessonDocumentation(models.Model, CRUDMixin):
""" A documentation on a single lesson period. Non-personal, includes """ A documentation on a single lesson period. Non-personal, includes
the topic and homework of the lesson. the topic and homework of the lesson.
""" """
...@@ -43,20 +43,21 @@ class LessonDocumentation(SchoolRelated): ...@@ -43,20 +43,21 @@ class LessonDocumentation(SchoolRelated):
homework = models.CharField(verbose_name=_('Homework'), max_length=200, blank=True) homework = models.CharField(verbose_name=_('Homework'), max_length=200, blank=True)
class Meta: class Meta:
unique_together = [['school', 'lesson_period', 'week']] unique_together = [['lesson_period', 'week']]
ordering = ['lesson_period__lesson__date_start', 'week', ordering = ['lesson_period__lesson__date_start', 'week',
'lesson_period__period__weekday', 'lesson_period__period__period'] 'lesson_period__period__weekday', 'lesson_period__period__period']
class PersonalNoteFilter(SchoolRelated): class PersonalNoteFilter(models.Model):
""" A filter definition that can generate statistics on personal note texts. """ """ A filter definition that can generate statistics on personal note texts. """
identifier = models.CharField(verbose_name=_('Identifier'), max_length=30, identifier = models.CharField(verbose_name=_('Identifier'), max_length=30,
validators=[isidentifier]) validators=[isidentifier], unique=True)
description = models.CharField(verbose_name=_('Description'), max_length=60, blank=True) description = models.CharField(verbose_name=_('Description'), max_length=60,
blank=True, unique=True)
regex = models.CharField(verbose_name=_('Match expression'), max_length=100) regex = models.CharField(verbose_name=_('Match expression'), max_length=100,
unique=True)
class Meta: class Meta:
unique_together = [['school', 'identifier'], ['school', 'description'], ['school', 'regex']]
ordering = ['identifier'] ordering = ['identifier']
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<section class="sheet padding-10mm bigprint" id="titlepage"> <section class="sheet padding-10mm bigprint" id="titlepage">
<div> <div>
<h1>{% trans 'Class register' %}</h1> <h1>{% trans 'Class register' %}</h1>
<img src="{% cropped_thumbnail group.school 'logo_cropping' max_size='600x600' %}" id="school-logo" /> <img src="{% cropped_thumbnail school 'logo_cropping' max_size='600x600' %}" id="school-logo" />
<p id="group-desc"> <p id="group-desc">
{{ group.name }} {{ group.name }}
</p> </p>
......
...@@ -13,7 +13,7 @@ from django_tables2 import RequestConfig ...@@ -13,7 +13,7 @@ from django_tables2 import RequestConfig
from biscuit.apps.chronos.models import LessonPeriod from biscuit.apps.chronos.models import LessonPeriod
from biscuit.apps.chronos.util import CalendarWeek from biscuit.apps.chronos.util import CalendarWeek
from biscuit.core.models import Group, Person from biscuit.core.models import Group, Person, School
from biscuit.core.decorators import admin_required from biscuit.core.decorators import admin_required
from biscuit.core.util import messages from biscuit.core.util import messages
...@@ -176,7 +176,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse: ...@@ -176,7 +176,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
'documentations', 'personal_notes' 'documentations', 'personal_notes'
) )
weeks = CalendarWeek.weeks_within(group.school.current_term.date_start, group.school.current_term.date_end) weeks = CalendarWeek.weeks_within(School.objects.first().current_term.date_start, School.objects.first().current_term.date_end)
periods_by_day = {} periods_by_day = {}
for lesson_period in lesson_periods: for lesson_period in lesson_periods:
for week in weeks: for week in weeks:
...@@ -216,6 +216,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse: ...@@ -216,6 +216,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
context['weeks'] = weeks context['weeks'] = weeks
context['periods_by_day'] = periods_by_day context['periods_by_day'] = periods_by_day
context['today'] = date.today() context['today'] = date.today()
context['school'] School.objects.first()
return render(request, 'alsijil/print/full_register.html', context) return render(request, 'alsijil/print/full_register.html', context)
......
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