Fix #614 -- Warning message if ticket output is active but no provider

This commit is contained in:
Raphael Michel
2017-09-04 21:03:17 +02:00
parent ea7ec2b5fc
commit d3a76e9f2f
2 changed files with 17 additions and 0 deletions

View File

@@ -6,6 +6,14 @@
{% csrf_token %}
<fieldset>
<legend>{% trans "Ticket download" %}</legend>
{% if request.event.settings.ticket_download and not any_enabled %}
<div class="alert alert-warning">
{% blocktrans trimmed %}
You activated ticket downloads but no output provider is enabled. Be sure to enable a plugin and
activate an output provider.
{% endblocktrans %}
</div>
{% endif %}
{% bootstrap_form_errors form %}
{% bootstrap_field form.ticket_download layout="horizontal" %}
{% bootstrap_field form.ticket_download_date layout="horizontal" %}

View File

@@ -585,6 +585,15 @@ class TicketSettings(EventPermissionRequiredMixin, FormView):
def get_context_data(self, *args, **kwargs) -> dict:
context = super().get_context_data(*args, **kwargs)
context['providers'] = self.provider_forms
context['any_enabled'] = False
responses = register_ticket_outputs.send(self.request.event)
for receiver, response in responses:
provider = response(self.request.event)
if provider.is_enabled:
context['any_enabled'] = True
break
return context
def get_success_url(self) -> str: