Commit ec10a43a authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg Committed by Luko van der Maas

Prevent unpublished events from ending up in the newsletter

parent 65b71c1c
......@@ -57,7 +57,10 @@ def save_to_disk(newsletter, request):
def get_agenda(start_date):
end_date = start_date + timezone.timedelta(weeks=2)
base_events = Event.objects.filter(
start__gte=start_date, end__lt=end_date).order_by('start')
start__gte=start_date,
end__lt=end_date,
published=True
).order_by('start')
if base_events.count() < 10:
more_events = Event.objects.filter(end__gte=end_date).order_by('start')
return [*base_events, *more_events][:10]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment