{% extends "base.html" %} {% block content %}

Drehplan

{% for d in days if (d.index < 5) or (d.lectures|length) > 0 %}{% endfor %} {# iterating over each 15 min block #} {% for t in times %} {% set time_loop = loop %} {# display time in first row if its a full hour #} {% if ((loop.index - 1) is divisibleby 4) %} {% endif %} {# iterate over days if if it is a working day or we have lectures on that day (optionaly skip weekends) #} {% for d in days if (d.index < 5) or (d.lectures|length) > 0 %} {% for col in range(1,d.maxcol+1) %} {# iterate over all lextures but only consider those that are in the current column and happen in the 15 min block #} {% for l in d.lectures|selectattr('timetable_col','equalto',col) if (((l.time.time() > t) and (l.time.time() < times[time_loop.index+1])) != (l.time.time() == t ) ) %} {# handle the first column of a day specialy, set red background if hidden #} {% else %} {# if the lecture is in the current collumn but not the current time slot #} {% for l in d.lectures|selectattr('timetable_col','equalto',col) if (l.time.time() < t) and (l.time_end.time() > t) %} {# this part is covered by another lecture using rowspan #} {% else %} {# no lecture right now, jsut end column #} {% endfor %} {% endfor %} {# end lecture #} {% endfor %} {# end day column #} {% endfor %} {# end day #} {% endfor %} {# end 15 min block #}
{{ d.date.strftime("%A (%d.%m.%Y)") }}
{{ t.strftime("%H:%M") }} {# print the lecture block #}

{{l.course.short}} {{l.course.short}}
{{l.time.strftime("%H:%M")}} - {{l.time_end.strftime("%H:%M")}}
{{l.place}}

{% endblock %}