mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Add improved UI if no event can be created
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
<h1>{% trans "Create a new event" %} <small>{% blocktrans trimmed with step=wizard.steps.step1 %}
|
<h1>{% trans "Create a new event" %} <small>{% blocktrans trimmed with step=wizard.steps.step1 %}
|
||||||
Step {{ step }}
|
Step {{ step }}
|
||||||
{% endblocktrans %}</small></h1>
|
{% endblocktrans %}</small></h1>
|
||||||
|
{% if has_organizer %}
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ wizard.management_form }}
|
{{ wizard.management_form }}
|
||||||
@@ -24,4 +25,14 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
{% trans "Every event needs to be created as part of an organizer account. Currently, you do not have access to any organizer accounts." %}
|
||||||
|
</div>
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<a href="{% url "control:organizers.add" %}" class="btn btn-default">
|
||||||
|
{% trans "Create a new organizer" %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
from formtools.wizard.views import SessionWizardView
|
from formtools.wizard.views import SessionWizardView
|
||||||
|
|
||||||
from pretix.base.models import Event, EventPermission
|
from pretix.base.models import Event, EventPermission, OrganizerPermission
|
||||||
from pretix.control.forms.event import (
|
from pretix.control.forms.event import (
|
||||||
EventWizardBasicsForm, EventWizardCopyForm, EventWizardFoundationForm,
|
EventWizardBasicsForm, EventWizardCopyForm, EventWizardFoundationForm,
|
||||||
)
|
)
|
||||||
@@ -48,6 +48,12 @@ class EventWizard(SessionWizardView):
|
|||||||
'copy': condition_copy
|
'copy': condition_copy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_context_data(self, form, **kwargs):
|
||||||
|
ctx = super().get_context_data(form, **kwargs)
|
||||||
|
ctx['has_organizer'] = OrganizerPermission.objects.filter(user=self.request.user,
|
||||||
|
can_create_events=True).exists()
|
||||||
|
return ctx
|
||||||
|
|
||||||
def get_form_kwargs(self, step=None):
|
def get_form_kwargs(self, step=None):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'user': self.request.user
|
'user': self.request.user
|
||||||
|
|||||||
Reference in New Issue
Block a user