Commit e0210936 authored by Luko van der Maas's avatar Luko van der Maas

Merge branch 'fix/newsletter-event-published' into 'master'

Prevent unpublished events from ending up in the newsletter

Closes #905

See merge request !1334
parents 65b71c1c ec10a43a
......@@ -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