diff --git a/src/pretix/control/templates/pretixcontrol/organizers/detail.html b/src/pretix/control/templates/pretixcontrol/organizers/detail.html index 45c03b089..3a396dc6d 100644 --- a/src/pretix/control/templates/pretixcontrol/organizers/detail.html +++ b/src/pretix/control/templates/pretixcontrol/organizers/detail.html @@ -22,7 +22,7 @@ {% endif %} {% for title, content in tabs %}
  • - + {{ title }}
  • @@ -149,7 +149,7 @@ {% endif %} {% for title, content in tabs %} -
    +
    {{ content }}
    diff --git a/src/pretix/control/views/organizer.py b/src/pretix/control/views/organizer.py index d421eefd3..1e53f742d 100644 --- a/src/pretix/control/views/organizer.py +++ b/src/pretix/control/views/organizer.py @@ -61,14 +61,26 @@ class OrganizerDetail(OrganizerPermissionRequiredMixin, DetailView): form=OrganizerPermissionForm, can_delete=True, can_order=False, extra=0 ) - return fs(data=self.request.POST if self.request.method == "POST" else None, - prefix="formset", - queryset=OrganizerPermission.objects.filter(organizer=self.request.organizer)) + return fs( + data=( + self.request.POST + if self.request.method == "POST" and 'id_formset-TOTAL_FORMS' in self.request.POST + else None + ), + prefix="formset", + queryset=OrganizerPermission.objects.filter(organizer=self.request.organizer) + ) @cached_property def add_form(self): - return OrganizerPermissionCreateForm(data=self.request.POST if self.request.method == "POST" else None, - prefix="add") + return OrganizerPermissionCreateForm( + data=( + self.request.POST + if self.request.method == "POST" and 'id_formset-TOTAL_FORMS' in self.request.POST + else None + ), + prefix="add" + ) def get_context_data(self, **kwargs): ctx = super().get_context_data(**kwargs) @@ -107,6 +119,9 @@ class OrganizerDetail(OrganizerPermissionRequiredMixin, DetailView): if not self.request.orgaperm.can_change_permissions: raise PermissionDenied(_("You have no permission to do this.")) + if 'id_formset-TOTAL_FORMS' not in self.request.POST: + return self.get(*args, **kwargs) + if self.formset.is_valid() and self.add_form.is_valid(): if self.add_form.has_changed(): logdata = { diff --git a/src/pretix/static/pretixcontrol/js/ui/main.js b/src/pretix/static/pretixcontrol/js/ui/main.js index 8e5405927..85af50fa4 100644 --- a/src/pretix/static/pretixcontrol/js/ui/main.js +++ b/src/pretix/static/pretixcontrol/js/ui/main.js @@ -84,7 +84,15 @@ $(function () { $('.collapsible').collapse(); - $('[data-toggle="tooltip"]').tooltip() + $('[data-toggle="tooltip"]').tooltip(); + + var url = document.location.toString(); + if (url.match('#')) { + $('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show'); + } + $('a[data-toggle="tab"]').on('click', function (e) { + window.location.hash = e.target.hash; + }); // Question editor if ($("#answer-options").length) {