mirror of
https://github.com/pretix/pretix.git
synced 2026-08-22 12:42:00 +00:00
Event calendar: Allow to show a message if no events are found
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user