diff --git a/backend/hub/context_processors.py b/backend/hub/context_processors.py index 603b35ac..12fd7cc6 100644 --- a/backend/hub/context_processors.py +++ b/backend/hub/context_processors.py @@ -23,6 +23,7 @@ def hub_settings(_: HttpRequest) -> Dict[str, Any]: candidate_confirmation_enabled = flags.get(FLAG_CHOICES.enable_candidate_confirmation, False) results_enabled = flags.get(FLAG_CHOICES.enable_results_display, False) org_approval_enabled = flags.get(FLAG_CHOICES.enable_org_approval, False) + org_editing_enabled = flags.get(FLAG_CHOICES.enable_org_editing, False) org_registration_enabled = flags.get(FLAG_CHOICES.enable_org_registration, False) return { @@ -44,6 +45,7 @@ def hub_settings(_: HttpRequest) -> Dict[str, Any]: "CANDIDATE_CONFIRMATION_ENABLED": candidate_confirmation_enabled, "RESULTS_ENABLED": results_enabled, "ORG_APPROVAL_ENABLED": org_approval_enabled, + "ORG_EDITING_ENABLED": org_editing_enabled, "ORG_REGISTRATION_ENABLED": org_registration_enabled, # Settings flags "GLOBAL_SUPPORT_ENABLED": flags.get(SETTINGS_CHOICES.global_support_round, False), diff --git a/backend/hub/forms.py b/backend/hub/forms.py index 937c551c..4916bf02 100644 --- a/backend/hub/forms.py +++ b/backend/hub/forms.py @@ -196,17 +196,21 @@ def _set_fields_permissions(self): # If registration is closed, updating the organization/candidate shouldn't be possible # it should be possible if they have a registered candidate and the organization editing is enabled - if not ( - hasattr(self.instance, "candidate") - and self.instance.candidate - and self.instance.candidate.is_proposed - and FeatureFlag.flag_enabled(FLAG_CHOICES.enable_org_editing) - ) and not FeatureFlag.flag_enabled(FLAG_CHOICES.enable_candidate_registration): + if ( + not FeatureFlag.flag_enabled(FLAG_CHOICES.enable_org_editing) + or not ( + hasattr(self.instance, "candidate") and self.instance.candidate and self.instance.candidate.is_proposed + ) + and not FeatureFlag.flag_enabled(FLAG_CHOICES.enable_candidate_registration) + ): for field_name in self.fields: self.fields[field_name].disabled = True if "voting_domain" in self.fields: - self.fields["voting_domain"].disabled = self.instance.voting_domain is not None + if not FeatureFlag.flag_enabled(FLAG_CHOICES.enable_org_editing): + self.fields["voting_domain"].disabled = True + else: + self.fields["voting_domain"].disabled = self.instance.voting_domain is not None return @@ -308,7 +312,6 @@ class Meta: class CandidateRegisterForm(CandidateCommonForm): - class Meta(CandidateCommonForm.Meta): widgets = { "is_proposed": forms.HiddenInput(), @@ -343,7 +346,6 @@ def clean(self): class CandidateUpdateForm(CandidateCommonForm): - class Meta(CandidateCommonForm.Meta): exclude: List[str] = ["org", "initial_org", "status", "status_changed"] diff --git a/backend/hub/templates/hub/ngo/update.html b/backend/hub/templates/hub/ngo/update.html index c934699a..03790c0c 100644 --- a/backend/hub/templates/hub/ngo/update.html +++ b/backend/hub/templates/hub/ngo/update.html @@ -53,23 +53,6 @@