Apply review comments

This commit is contained in:
Antoine Bartuccio 2025-02-25 18:28:16 +01:00
parent a01ea13f5b
commit a653f98fc1

View File

@ -261,15 +261,13 @@ class NewsListView(TemplateView):
D on 20/03, E on 21/03 and F on 22/03 ;
then the result is 20/03.
"""
try:
return list(
dates = list(
NewsDate.objects.filter(end_date__gt=now())
.order_by("start_date")
.values_list("start_date__date", flat=True)
.distinct()[:4]
)[-1]
except IndexError:
return None
)
return dates[-1] if len(dates) > 0 else None
def get_news_dates(self, until: date) -> dict[date, list[date]]:
"""Return the event dates to display.