Event setup: do not create new team when staff session active (#2132)

With b260cca412, team provisioning has
been disabled for users that are staff. However, this leads to strange
UX, as a new event created by a staff member, not currently in a staff
session resulted in a 404 directly after creation.

The PR updates this requirement to not need to select a team, only when
a staff session is active.
This commit is contained in:
Maico Timmerman
2021-06-22 09:26:09 +02:00
committed by GitHub
parent b7f5631ad0
commit 8b9b86a68d
2 changed files with 6 additions and 5 deletions

View File

@@ -161,6 +161,7 @@ class EventWizard(SafeSessionWizardView):
initial['locales'] = self.clone_from.settings.locales
initial['has_subevents'] = self.clone_from.has_subevents
elif step == 'basics':
initial['request'] = self.request
initial['name'] = self.clone_from.name
if re.match('^.*-[0-9]+$', self.clone_from.slug):
@@ -270,7 +271,7 @@ class EventWizard(SafeSessionWizardView):
user=self.request.user,
)
if not EventWizardBasicsForm.has_control_rights(self.request.user, event.organizer):
if not EventWizardBasicsForm.has_control_rights(self.request.user, event.organizer, self.request.session):
if basics_data["team"] is not None:
t = basics_data["team"]
t.limit_events.add(event)