<tr><thstyle="width: 30px;"></th>{% for d in days if (d.index <5)or(d.lectures|length)> 0 %}<thstyle="min-width: 10em;"colspan="{{d.maxcol}}">{{ d.date.strftime("%A (%d.%m.%Y)") }}</th>{% endfor %}</tr>
<tr><thstyle="width: 30px;"></th>{% for d in days if (d.index <5)or(d.lectures|length)> 0 %}<thstyle="min-width: 10em;"colspan="{{d.maxcol}}">{{ d.date.strftime("%A (%d.%m.%Y)") }}</th>{% endfor %}</tr>
{# display time in first row if its a full hour #}
{% if ((loop.index - 1) is divisibleby 4) %} <tdrowspan="4"style="vertical-align: top;">{{ t.strftime("%H:%M") }}</td> {% endif %}
{% if ((loop.index - 1) is divisibleby 4) %} <tdrowspan="4"style="vertical-align: top;">{{ t.strftime("%H:%M") }}</td> {% 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 d in days if (d.index <5)or(d.lectures|length)> 0 %}
{% for i in range(1,d.maxcol+1) %}
{% for col in range(1,d.maxcol+1) %}
{% for l in d.lectures|selectattr('timetable_col','equalto',i) if (((l.time.time() > t) and (l.time.time() <times[time_loop.index+1]))!=(l.time.time() ==t))%}
<td{%ifi ==1%}class="newday"{%endif%}rowspan="{{l.duration / 15}}"style="background: {% if l.visible and l.course.visible %}lightgrey;{% else %}#f2dede{% endif %}">
{# 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))%}