Skip to content
Snippets Groups Projects
Verified Commit 526c53fb authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add support for showing parent groups instead of original groups

if there is only one group and this group has parent groups

Advance #71
parent 02b1167a
No related branches found
No related tags found
1 merge request!46Resolve "Improve display of groups in timetable views"
This commit is part of merge request !46. Comments created here will be created in the context of that merge request.
from django.utils.translation import gettext_lazy as _
CONSTANCE_CONFIG = {
"CHRONOS_USE_PARENT_GROUPS": (
False,
_(
"If an lesson or substitution has only one group"
" and this group has parent groups,"
" show the parent groups instead of the original group."
),
),
"CHRONOS_SUBSTITUTIONS_PRINT_DAY_NUMBER": (
2,
_("Number of days shown on substitutions print view"),
......@@ -12,6 +20,7 @@ CONSTANCE_CONFIG = {
}
CONSTANCE_CONFIG_FIELDSETS = {
"Chronos settings": (
"CHRONOS_USE_PARENT_GROUPS",
"CHRONOS_SUBSTITUTIONS_PRINT_DAY_NUMBER",
"CHRONOS_SUBSTITUTIONS_SHOW_HEADER_BOX",
),
......
{% for group in groups %}
<a href="{% url "timetable" "group" group.pk %}">
{{ group.short_name }}{% if not forloop.last %},{% endif %}
</a>
{% endfor %}
{% if groups.count == 1 and groups.0.parent_groups.all and config.CHRONOS_USE_PARENT_GROUPS %}
{% include "chronos/partials/groups_part.html" with groups=groups.0.parent_groups.all %}
{% else %}
{% include "chronos/partials/groups_part.html" with groups=groups %}
{% endif %}
{% for group in groups %}
<a href="{% url "timetable" "group" group.pk %}">
{{ group.short_name }}{% if not forloop.last %},{% endif %}
</a>
{% endfor %}
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