Skip to content
Snippets Groups Projects
Commit 0b8cc230 authored by permcu's avatar permcu
Browse files

Adapt the register_abbreviations to the new datamodel

parent 68909450
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !422. Comments created here will be created in the context of that merge request.
......@@ -15,6 +15,7 @@ from aleksis.core.util.celery_progress import ProgressRecorder, recorded_task
from aleksis.core.util.pdf import generate_pdf_from_template
from aleksis.apps.cursus.models import Course
from aleksis.apps.kolego.absence import AbsenceReason
from .models import ExtraMark
......@@ -162,6 +163,11 @@ def generate_full_register_printout(
if include_cover:
group = group.select_related("school_term")
if include_abbreviations:
# TODO: AbsenceReasonTag important?
context["absence_reasons"] = AbsenceReason.objects.all()
context["extra_marks"] = ExtraMark.objects.all()
if include_teachers_and_subjects_table:
group = group.prefetch_related(
"courses",
......
<h4>{% trans "Abbreviations" %}</h4>
<h5>{% trans "General" %}</h5>
<ul class="collection">
<li class="collection-item">
<strong>(a)</strong> {% trans "Absent" %}
</li>
<li class="collection-item">
<strong>(b)</strong> {% trans "Late" %}
</li>
<li class="collection-item">
<strong>(u)</strong> {% trans "Unexcused" %}
</li>
<li class="collection-item">
<strong>(e)</strong> {% trans "Excused" %}
</li>
</ul>
{% if excuse_types %}
<h5>{% trans "Custom excuse types" %}</h5>
{% if absence_reasons %}
<h5>{% trans "Absence reasons" %}</h5>
<ul class="collection">
{% for excuse_type in excuse_types %}
<li class="collection-item">
<strong>({{ excuse_type.short_name }})</strong> {{ excuse_type.name }}
</li>
{% for absence_reason in absence_reasons %}
{% if absence_reason.count_as_absent %}
<li class="collection-item">
<strong>({{ absence_reason.short_name }})</strong> {{ absence_reason.name }}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if excuse_types_not_absent %}
<h5>{% trans "Custom excuse types (not counted as absent)" %}</h5>
<h5>{% trans "Absence reasons (not counted as absent)" %}</h5>
<ul class="collection">
{% for excuse_type in excuse_types_not_absent %}
<li class="collection-item">
<strong>({{ excuse_type.short_name }})</strong> {{ excuse_type.name }}
</li>
{% for absence_reason in absence_reasons %}
{% if not absence_reason.count_as_absent %}
<li class="collection-item">
<strong>({{ absence_reason.short_name }})</strong> {{ absence_reason.name }}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
......
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