Event calendar: Allow to show a message if no events are found

This commit is contained in:
Raphael Michel
2026-08-07 14:10:30 +02:00
parent 421a2e37d0
commit 73d03aa037
16 changed files with 107 additions and 4 deletions
+6
View File
@@ -642,6 +642,8 @@ class WidgetAPIProductList(EventListMixin, View):
sales_channel=self.request.sales_channel,
)
if not any(ebd):
data['empty_text'] = str(rich_text(request.event.settings.event_list_empty_text, safelinks=False))
data['weeks'] = weeks_for_template(ebd, self.year, self.month)
for w in data['weeks']:
for d in w:
@@ -700,6 +702,8 @@ class WidgetAPIProductList(EventListMixin, View):
sales_channel=self.request.sales_channel,
)
if not any(ebd):
data['empty_text'] = str(rich_text(request.event.settings.event_list_empty_text, safelinks=False))
data['days'] = days_for_template(ebd, week)
for d in data['days']:
d['events'] = self._serialize_events(d['events'] or [])
@@ -770,6 +774,8 @@ class WidgetAPIProductList(EventListMixin, View):
'event_url': eventreverse_absolute(event, 'presale:event.index'),
})
if not data['events']:
data['empty_text'] = str(rich_text(request.event.settings.event_list_empty_text, safelinks=False))
cache.set(cache_key, data, 30)
# These pages are cached for a really short duration this should make them pretty accurate, while still
# providing some protection against burst traffic.