fix(pages.py): generate event occurrences only if live
This commit is contained in:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user