mirror of
https://github.com/ae-utbm/sith.git
synced 2025-02-27 01:47:14 +00:00
Apply review comments
This commit is contained in:
parent
a01ea13f5b
commit
a653f98fc1
16
com/views.py
16
com/views.py
@ -261,15 +261,13 @@ class NewsListView(TemplateView):
|
|||||||
D on 20/03, E on 21/03 and F on 22/03 ;
|
D on 20/03, E on 21/03 and F on 22/03 ;
|
||||||
then the result is 20/03.
|
then the result is 20/03.
|
||||||
"""
|
"""
|
||||||
try:
|
dates = list(
|
||||||
return list(
|
NewsDate.objects.filter(end_date__gt=now())
|
||||||
NewsDate.objects.filter(end_date__gt=now())
|
.order_by("start_date")
|
||||||
.order_by("start_date")
|
.values_list("start_date__date", flat=True)
|
||||||
.values_list("start_date__date", flat=True)
|
.distinct()[:4]
|
||||||
.distinct()[:4]
|
)
|
||||||
)[-1]
|
return dates[-1] if len(dates) > 0 else None
|
||||||
except IndexError:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_news_dates(self, until: date) -> dict[date, list[date]]:
|
def get_news_dates(self, until: date) -> dict[date, list[date]]:
|
||||||
"""Return the event dates to display.
|
"""Return the event dates to display.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user