diff --git a/src/agenda_culturel/calendar.py b/src/agenda_culturel/calendar.py index c80a922..2a5d73b 100644 --- a/src/agenda_culturel/calendar.py +++ b/src/agenda_culturel/calendar.py @@ -117,15 +117,23 @@ class DayInCalendar: if e.start_time is None else e.start_time ) + self.today_night = False if self.is_today(): + self.today_night = True now = timezone.now() nday = now.date() ntime = now.time() + found = False for idx,e in enumerate(self.events): if (nday < e.start_day) or (nday == e.start_day and e.start_time and ntime <= e.start_time): self.events[idx].is_first_after_now = True + found = True break + if found: + self.today_night = False + def is_today_after_events(self): + return self.is_today() and self.today_night def events_by_category_ordered(self): from .models import Category diff --git a/src/agenda_culturel/templates/agenda_culturel/page-week.html b/src/agenda_culturel/templates/agenda_culturel/page-week.html index 2f1db3a..9136e32 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-week.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-week.html @@ -150,6 +150,9 @@ {% endfor %} + {% if day.is_today_after_events %} +
  • {% now "H:i" %}
  • + {% endif %} {% endif %}