On ajoute la ligne now à la fin

This commit is contained in:
Jean-Marie Favreau 2024-12-09 22:59:34 +01:00
parent 6e8f00ccbe
commit c91cdf0c99
2 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -150,6 +150,9 @@
</dialog>
</li>
{% endfor %}
{% if day.is_today_after_events %}
<li class="line-now"><div><div>{% now "H:i" %}</div><div class="line"></div></div></li>
{% endif %}
</ul>
{% endif %}
</ul>