diff --git a/src/registrar/forms/domain.py b/src/registrar/forms/domain.py index e9f756acb..847fd4a9b 100644 --- a/src/registrar/forms/domain.py +++ b/src/registrar/forms/domain.py @@ -508,6 +508,7 @@ class DomainOrgNameAddressForm(forms.ModelForm): return old_value == new_value +# TODO: Will be refined in #2352 class DomainSuborganizationForm(forms.ModelForm): """Form for updating the suborganization""" @@ -536,6 +537,9 @@ class DomainSuborganizationForm(forms.ModelForm): # Use the combobox rather than the regular select widget self.fields['sub_organization'].widget.template_name = "django/forms/widgets/combobox.html" + # TODO: Remove in #2352 + DomainHelper.disable_field(self.fields['sub_organization'], disable_required=True) + class DomainDnssecForm(forms.Form): diff --git a/src/registrar/templates/domain_suborganization.html b/src/registrar/templates/domain_suborganization.html index ed0cb69f3..cac0fde01 100644 --- a/src/registrar/templates/domain_suborganization.html +++ b/src/registrar/templates/domain_suborganization.html @@ -15,11 +15,16 @@ If you believe there is an error please contact help@get.gov.

- {% include "includes/required_fields.html" %} + {% if suborganization_is_editable %} + {% include "includes/required_fields.html" %} + {% endif %} +
{% csrf_token %} {% input_with_errors form.sub_organization %} - + {% if suborganization_is_editable %} + + {% endif %}
{% endblock %} diff --git a/src/registrar/templates/includes/input_with_errors.html b/src/registrar/templates/includes/input_with_errors.html index 623ec0a33..a37af5729 100644 --- a/src/registrar/templates/includes/input_with_errors.html +++ b/src/registrar/templates/includes/input_with_errors.html @@ -67,8 +67,10 @@ error messages, if necessary. {% include "includes/readonly_input.html" %} {% endif %} - {# this is the input field, itself #} - {% include widget.template_name %} + {# this is the input field, itself. Toggleable because of the show_readonly flag. #} + {% if not remove_input_field %} + {% include widget.template_name %} + {% endif %} {% if append_gov %} .gov diff --git a/src/registrar/views/domain.py b/src/registrar/views/domain.py index a56629a5b..5614612b3 100644 --- a/src/registrar/views/domain.py +++ b/src/registrar/views/domain.py @@ -26,6 +26,7 @@ from registrar.models import ( UserDomainRole, ) from registrar.models.public_contact import PublicContact +from registrar.models.utility.domain_helper import DomainHelper from registrar.utility.enums import DefaultEmail from registrar.utility.errors import ( GenericError, @@ -222,6 +223,7 @@ class DomainOrgNameAddressView(DomainFormBaseView): return super().form_valid(form) +# TODO: Edit will be added in #2352 class DomainSubOrganizationView(DomainFormBaseView): """Suborganization view""" @@ -249,6 +251,15 @@ class DomainSubOrganizationView(DomainFormBaseView): # superclass has the redirect return super().form_valid(form) + def get_context_data(self, **kwargs): + """Adds custom context.""" + context = super().get_context_data(**kwargs) + + # TODO: Switch to True #2352 + suborganization_is_editable = False + context["suborganization_is_editable"] = suborganization_is_editable + return context + class DomainSeniorOfficialView(DomainFormBaseView): """Domain senior official editing view."""