fix(pages.py): generate event occurrences only if live

This commit is contained in:
2026-03-30 09:47:46 +02:00
parent 64edf6656e
commit 7e24ded8ee

View File

@@ -288,6 +288,8 @@ class EventPage(Page):
Generate EventOccurrence objects for this event based on recurrence settings.
For endless recurrence, generate up to days_ahead into the future.
"""
from .event_occurrence import EventOccurrence
now = timezone.now()
if not self.recurrence_enabled:
# if recurrence is not enabled, ensure there's at least one occurrence for the specified start/end
@@ -337,7 +339,8 @@ class EventPage(Page):
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
self.generate_occurrences()
if self.live:
self.generate_occurrences()
content_panels = Page.content_panels + [
FieldPanel("tags"),