diff --git a/aleksis/apps/chronos/templates/chronos/timetable.html b/aleksis/apps/chronos/templates/chronos/timetable.html index b017b2dccf3b88074e153bedae79bb27164c25ea..a806f63e44a5f6c83a04d5e3869453203bca989b 100644 --- a/aleksis/apps/chronos/templates/chronos/timetable.html +++ b/aleksis/apps/chronos/templates/chronos/timetable.html @@ -124,14 +124,14 @@ </div> {# Show short weekdays on tablets #} - {% for i, day in weekdays_short.items %} + {% for i, weekday, date in weekdays_short %} <div class="col s2 hide-on-large-only"> <div class="card timetable-title-card"> <div class="card-content"> <span class="card-title"> - {{ day.0 }} + {{ weekday }} </span> - {{ day.1 }} + {{ date }} {# {% if day.1 %}#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# {% endif %}#} @@ -141,14 +141,14 @@ {% endfor %} {# Show long weekdays elsewere #} - {% for i, day in weekdays.items %} + {% for i, weekday, date in weekdays %} <div class="col s2 hide-on-med-only"> <div class="card timetable-title-card"> <div class="card-content"> <span class="card-title"> - {{ day.0 }} + {{ weekday }} </span> - {{ day.1 }} + {{ date }} {# {% if day.1 %}#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# {% endif %}#} @@ -178,13 +178,13 @@ {# show 5 seperate ones on mobiles #} <div class="timetable-plan hide-on-med-and-up"> - {% for i, day in weekdays.items %} + {% for i, weekday, date in weekdays %} <div class="card timetable-mobile-title-card"> <div class="card-content"> <span class="card-title"> - {{ day.0 }} + {{ weekday }} </span> - {{ day.1 }} + {{ date }} {# {% if day.1 %}#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# {% endif %}#} diff --git a/aleksis/apps/chronos/views.py b/aleksis/apps/chronos/views.py index 21de994ed95f3b6266b71d8cfc19b41ad3dbfb40..d19ee0f8291faeb439fc19a35675cad3051cbfee 100644 --- a/aleksis/apps/chronos/views.py +++ b/aleksis/apps/chronos/views.py @@ -150,22 +150,21 @@ def timetable( context["lesson_periods"] = OrderedDict(sorted(per_period.items())) context["periods"] = TimePeriod.get_times_dict() - context["weekdays"] = dict( - [ - (key, (item, wanted_week[key])) - for key, item in TimePeriod.WEEKDAY_CHOICES[ - TimePeriod.weekday_min : TimePeriod.weekday_max + 1 - ] + + # Build lists with weekdays and corresponding dates (long and short variant) + context["weekdays"] = [ + (key, weekday, wanted_week[key]) + for key, weekday in TimePeriod.WEEKDAY_CHOICES[ + TimePeriod.weekday_min : TimePeriod.weekday_max + 1 ] - ) - context["weekdays_short"] = dict( - [ - (key, (item, wanted_week[key])) - for key, item in TimePeriod.WEEKDAY_CHOICES_SHORT[ - TimePeriod.weekday_min : TimePeriod.weekday_max + 1 - ] + ] + context["weekdays_short"] = [ + (key, weekday, wanted_week[key]) + for key, weekday in TimePeriod.WEEKDAY_CHOICES_SHORT[ + TimePeriod.weekday_min : TimePeriod.weekday_max + 1 ] - ) + ] + context["weeks"] = get_weeks_for_year(year=wanted_week.year) context["week"] = wanted_week context["type"] = type_