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