From dc7c78205016bd79c6d16e332f6b4dd15bae1b21 Mon Sep 17 00:00:00 2001 From: Neil Martinsen-Burrell Date: Mon, 9 Jan 2023 14:03:00 -0600 Subject: [PATCH] Fix issues from merge --- src/registrar/forms/application_wizard.py | 11 +++++++ .../templates/application_current_sites.html | 2 +- .../templates/application_dotgov_domain.html | 20 ++++++------ src/registrar/templates/application_form.html | 32 ++++++++++--------- .../templates/application_security_email.html | 12 +++---- 5 files changed, 45 insertions(+), 32 deletions(-) diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index fc780b760..f72336cd8 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -446,3 +446,14 @@ class RequirementsForm(RegistrarForm): ), required=False, # use field validation to enforce this ) + + def clean_is_policy_acknowledged(self): + """This box must be checked to proceed but offer a clear error.""" + # already converted to a boolean + is_acknowledged = self.cleaned_data["is_policy_acknowledged"] + if not is_acknowledged: + raise forms.ValidationError( + "You must read and agree to the .gov domain requirements to proceed.", + code="invalid", + ) + return is_acknowledged diff --git a/src/registrar/templates/application_current_sites.html b/src/registrar/templates/application_current_sites.html index 5b3943ef7..c72a7391f 100644 --- a/src/registrar/templates/application_current_sites.html +++ b/src/registrar/templates/application_current_sites.html @@ -8,7 +8,7 @@
{% csrf_token %} - {% input_with_errors forms.0.form.current_site %} + {% input_with_errors forms.0.current_site %} {{ block.super }} diff --git a/src/registrar/templates/application_dotgov_domain.html b/src/registrar/templates/application_dotgov_domain.html index dc968b278..4225764e5 100644 --- a/src/registrar/templates/application_dotgov_domain.html +++ b/src/registrar/templates/application_dotgov_domain.html @@ -28,23 +28,23 @@

This question is required.

{% csrf_token %} - {% if wizard.form.requested_domain.errors %} + {% if forms.0.requested_domain.errors %}
- {% for error in wizard.form.requested_domain.errors %} + {% for error in forms.0.requested_domain.errors %} {{ error }} {% endfor %}
www. - {{ wizard.form.requested_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }} + {{ forms.0.requested_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }} .gov
{% else %}
www. - {{ wizard.form.requested_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }} + {{ forms.0.requested_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }} .gov
{% endif %} @@ -53,25 +53,25 @@

Alternative domains

- {% if wizard.form.alternative_domain.errors %} + {% if forms.0.alternative_domain.errors %}
- {{ wizard.form.alternative_domain|add_label_class:"usa-label usa-label--error" }} - {% for error in wizard.for.alternative_domain.errors %} + {{ forms.0.alternative_domain|add_label_class:"usa-label usa-label--error" }} + {% for error in forms.0.alternative_domain.errors %} {{ error }} {% endfor %}
www. - {{ wizard.form.alternative_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }} + { forms.0.alternative_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }} .gov
{% else %} - {{ wizard.form.alternative_domain|add_label_class:"usa-label" }} + {{ forms.0.alternative_domain|add_label_class:"usa-label" }}
www. - {{ wizard.form.alternative_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }} + {{ forms.0.alternative_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }} .gov
{% endif %} diff --git a/src/registrar/templates/application_form.html b/src/registrar/templates/application_form.html index 52052f536..6117470a4 100644 --- a/src/registrar/templates/application_form.html +++ b/src/registrar/templates/application_form.html @@ -18,24 +18,26 @@ {% endif %} - {% if form.errors %} - {% for error in form.non_field_errors %} -
-
- {{ error|escape }} -
-
- {% endfor %} - {% for field in form %} - {% for error in field.errors %} -
+ {% for form in forms %} + {% if form.errors %} + {% for error in form.non_field_errors %} +
- {{ error|escape }} + {{ error|escape }} +
-
{% endfor %} - {% endfor %} - {% endif %} + {% for field in form %} + {% for error in field.errors %} +
+
+ {{ error|escape }} +
+
+ {% endfor %} + {% endfor %} + {% endif %} + {% endfor %}

{{form_titles|get_item:steps.current}}

{% block form_content %} diff --git a/src/registrar/templates/application_security_email.html b/src/registrar/templates/application_security_email.html index d2a4c6564..36595ad38 100644 --- a/src/registrar/templates/application_security_email.html +++ b/src/registrar/templates/application_security_email.html @@ -10,19 +10,19 @@ {% csrf_token %} - {% if wizard.form.security_email.errors %} + {% if forms.0.security_email.errors %}
- {{ wizard.form.security_email|add_label_class:"usa-label usa-label--error" }} - {% for error in wizard.form.security_email.errors %} + {{ forms.0.security_email|add_label_class:"usa-label usa-label--error" }} + {% for error in forms.0.security_email.errors %} {{ error }} {% endfor %} - {{ wizard.form.security_email|add_class:"usa-input"|add_class:"usa-input--error"|attr:"aria-describedby:instructions"|attr:"aria-invalid:true" }} + {{ forms.0.security_email|add_class:"usa-input"|add_class:"usa-input--error"|attr:"aria-describedby:instructions"|attr:"aria-invalid:true" }}
{% else %} - {{ wizard.form.security_email|add_label_class:"usa-label" }} - {{ wizard.form.security_email|add_class:"usa-input"|attr:"aria-describedby:instructions" }} + {{ forms.0.security_email|add_label_class:"usa-label" }} + {{ forms.0.security_email|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {% endif %} {{ block.super }}