Fix issues from merge

This commit is contained in:
Neil Martinsen-Burrell 2023-01-09 14:03:00 -06:00
parent 8d3991614e
commit dc7c782050
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
5 changed files with 45 additions and 32 deletions

View file

@ -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

View file

@ -8,7 +8,7 @@
<form class="usa-form usa-form--large" id="step__{{steps.current}}" method="post">
{% csrf_token %}
{% input_with_errors forms.0.form.current_site %}
{% input_with_errors forms.0.current_site %}
{{ block.super }}

View file

@ -28,23 +28,23 @@
<p> This question is required. </p>
{% csrf_token %}
{% if wizard.form.requested_domain.errors %}
{% if forms.0.requested_domain.errors %}
<div class="usa-form-group usa-form-group--error">
{% for error in wizard.form.requested_domain.errors %}
{% for error in forms.0.requested_domain.errors %}
<span class="usa-error-message" id="input-error-message" role="alert">
{{ error }}
</span>
{% endfor %}
<div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span>
{{ 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" }}
<span class="padding-top-05 padding-left-2px">.gov </span>
</div>
</div>
{% else %}
<div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span>
{{ 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" }}
<span class="padding-top-05 padding-left-2px">.gov </span>
</div>
{% endif %}
@ -53,25 +53,25 @@
<h2>Alternative domains</h2>
<div>
{% if wizard.form.alternative_domain.errors %}
{% if forms.0.alternative_domain.errors %}
<div class="usa-form-group usa-form-group--error">
{{ 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 %}
<span class="usa-error-message" id="input-error-message" role="alert">
{{ error }}
</span>
{% endfor %}
<div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span>
{{ 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" }}
<span class="padding-top-05 padding-left-2px">.gov </span>
</div>
</div>
{% else %}
{{ wizard.form.alternative_domain|add_label_class:"usa-label" }}
{{ forms.0.alternative_domain|add_label_class:"usa-label" }}
<div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span>
{{ 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" }}
<span class="padding-top-05 padding-left-2px">.gov </span>
</div>
{% endif %}

View file

@ -18,24 +18,26 @@
</a>
{% endif %}
{% if form.errors %}
{% for error in form.non_field_errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
<div class="usa-alert__body">
{{ error|escape }}
</div>
</div>
{% endfor %}
{% for field in form %}
{% for error in field.errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
{% for form in forms %}
{% if form.errors %}
{% for error in form.non_field_errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
<div class="usa-alert__body">
{{ error|escape }}
{{ error|escape }}
</div>
</div>
</div>
{% endfor %}
{% endfor %}
{% endif %}
{% for field in form %}
{% for error in field.errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
<div class="usa-alert__body">
{{ error|escape }}
</div>
</div>
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
<h1> {{form_titles|get_item:steps.current}} </h1>
{% block form_content %}

View file

@ -10,19 +10,19 @@
<form class="usa-form usa-form--large" id="step__{{steps.current}}" method="post" novalidate>
{% csrf_token %}
{% if wizard.form.security_email.errors %}
{% if forms.0.security_email.errors %}
<div class="usa-form-group usa-form-group--error">
{{ 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 %}
<span class="usa-error-message" id="input-error-message" role="alert">
{{ error }}
</span>
{% 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" }}
</div>
{% 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 }}