Allow to set a custom error message when presale is ended

This commit is contained in:
Raphael Michel
2019-03-29 16:38:47 +01:00
parent 46166159b0
commit 73ec5bac79
5 changed files with 24 additions and 4 deletions

View File

@@ -110,9 +110,13 @@
{% if not ev.presale_is_running %}
<div class="alert alert-info">
{% if ev.presale_has_ended %}
{% blocktrans trimmed %}
The presale period for this event is over.
{% endblocktrans %}
{% if event.settings.presale_has_ended_text %}
{{ event.settings.presale_has_ended_text|rich_text }}
{% else %}
{% blocktrans trimmed %}
The presale period for this event is over.
{% endblocktrans %}
{% endif %}
{% elif event.settings.presale_start_show_date %}
{% blocktrans trimmed with date=ev.presale_start|date:"SHORT_DATE_FORMAT" time=ev.presale_start|time:"TIME_FORMAT" %}
The presale for this event will start on {{ date }} at {{ time }}.

View File

@@ -437,7 +437,10 @@ class WidgetAPIProductList(EventListMixin, View):
if not ev.presale_is_running:
if ev.presale_has_ended:
data['error'] = ugettext('The presale period for this event is over.')
if request.event.settings.presale_has_ended_text:
data['error'] = str(request.event.settings.presale_has_ended_text)
else:
data['error'] = ugettext('The presale period for this event is over.')
elif request.event.settings.presale_start_show_date:
data['error'] = ugettext('The presale for this event will start on %(date)s at %(time)s.') % {
'date': date_format(ev.presale_start.astimezone(request.event.timezone), "SHORT_DATE_FORMAT"),