From 8a0037c86f8132a6693a128a24cd7f33b6b12fdc Mon Sep 17 00:00:00 2001 From: "Jonathan S. Katz" Date: Wed, 7 Oct 2020 17:59:22 -0400 Subject: [PATCH] Fix regression that prevented accessing new organisation page The addition of the fieldsets did not account for the fields themselves from being removed from the new organisation form. The OrganisationForm now removes the appropriate fieldset when the fields are not available in this form. --- pgweb/core/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pgweb/core/forms.py b/pgweb/core/forms.py index 5b1284f6..2b45fd79 100644 --- a/pgweb/core/forms.py +++ b/pgweb/core/forms.py @@ -49,6 +49,8 @@ class OrganisationForm(forms.ModelForm): else: del self.fields['remove_manager'] del self.fields['add_manager'] + # remove the managers fieldset + self.fieldsets = [fs for fs in self.fieldsets if fs['id'] != 'managers'] if self.instance and self.instance.pk and self.instance.is_approved: # Only allow adding/removing emails on orgs that are actually approved @@ -56,6 +58,8 @@ class OrganisationForm(forms.ModelForm): else: del self.fields['remove_email'] del self.fields['add_email'] + # remove the emails fieldset + self.fieldsets = [fs for fs in self.fieldsets if fs['id'] != 'emails'] def clean_add_email(self): if self.cleaned_data['add_email']: -- 2.39.5