review fixes

This commit is contained in:
matthewswspence 2025-03-26 15:03:12 -05:00
parent 926aefbd05
commit cb75ec84c3
No known key found for this signature in database
GPG key ID: FB458202A7852BA4
11 changed files with 112 additions and 87 deletions

View file

@ -2845,7 +2845,6 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
"cisa_representative_email",
"eop_stakeholder_first_name",
"eop_stakeholder_last_name",
"eop_stakeholder_email",
]
},
),
@ -3079,7 +3078,6 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
"interagency_initiative_details",
"eop_stakeholder_first_name",
"eop_stakeholder_last_name",
"eop_stakeholder_email",
]
)
modified_fieldsets = []

View file

@ -153,29 +153,12 @@ class EOPContactForm(BaseDeletableRegistrarForm):
error_messages={"required": "Enter the last name / family name of this contact."},
required=True,
)
email = forms.EmailField(
label="Email",
max_length=None,
error_messages={
"required": ("Enter an email address in the required format, like name@example.com."),
"invalid": ("Enter an email address in the required format, like name@example.com."),
},
validators=[
MaxLengthValidator(
320,
message="Response must be less than 320 characters.",
)
],
required=True,
help_text="Enter an email address in the required format, like name@example.com.",
)
@classmethod
def from_database(cls, obj):
return {
"first_name": obj.eop_stakeholder_first_name,
"last_name": obj.eop_stakeholder_last_name,
"email": obj.eop_stakeholder_email,
}
def to_database(self, obj):
@ -189,7 +172,6 @@ class EOPContactForm(BaseDeletableRegistrarForm):
return
obj.eop_stakeholder_first_name = self.cleaned_data["first_name"]
obj.eop_stakeholder_last_name = self.cleaned_data["last_name"]
obj.eop_stakeholder_email = self.cleaned_data["email"]
obj.save()

View file

@ -0,0 +1,56 @@
# Generated by Django 4.2.20 on 2025-03-26 19:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("registrar", "0144_domainrequest_eop_stakeholder_email_and_more"),
]
operations = [
migrations.RemoveField(
model_name="domainrequest",
name="eop_stakeholder_email",
),
migrations.AlterField(
model_name="domainrequest",
name="feb_naming_requirements",
field=models.BooleanField(blank=True, null=True, verbose_name="Meets Naming Requirements"),
),
migrations.AlterField(
model_name="domainrequest",
name="feb_naming_requirements_details",
field=models.TextField(
blank=True,
help_text="Required if requested domain that doesn't meet naming requirements",
null=True,
verbose_name="Domain name rationale",
),
),
migrations.AlterField(
model_name="domainrequest",
name="feb_purpose_choice",
field=models.CharField(
blank=True,
choices=[
("new", "Used for a new website"),
("redirect", "Used as a redirect for an existing website"),
("other", "Not for a website"),
],
null=True,
verbose_name="Purpose type",
),
),
migrations.AlterField(
model_name="domainrequest",
name="interagency_initiative_details",
field=models.TextField(blank=True, null=True, verbose_name="Interagency initiative"),
),
migrations.AlterField(
model_name="domainrequest",
name="time_frame_details",
field=models.TextField(blank=True, null=True, verbose_name="Target time frame"),
),
]

View file

@ -549,12 +549,6 @@ class DomainRequest(TimeStampedModel):
verbose_name="EOP Stakeholder Last Name",
)
eop_stakeholder_email = models.EmailField(
null=True,
blank=True,
verbose_name="EOP Stakeholder Email",
)
# This field is alternately used for generic domain purpose explanations
# and for explanations of the specific purpose chosen with feb_purpose_choice
purpose = models.TextField(

View file

@ -34,7 +34,6 @@
{% with add_label_class="usa-sr-only" attr_required="required" attr_maxlength="2000" %}
{% input_with_errors forms.1.purpose %}
{% endwith %}
<p class="usa-hint margin-top-0">Maximum 2000 characters allowed.</p>
</div>
<h2>Do you have a target time frame for launching this domain?</h2>
@ -52,7 +51,6 @@
{% with add_label_class="usa-sr-only" attr_required="required" attr_maxlength="2000" %}
{% input_with_errors forms.3.time_frame_details %}
{% endwith %}
<p class="usa-hint margin-top-0">Maximum 2000 characters allowed.</p>
</div>
<h2>Will the domain name be used for an interagency initiative?</h2>
@ -65,12 +63,11 @@
<div id="purpose-interagency-initaitive-details-container" class="conditional-panel">
<p class="margin-bottom-0 margin-top-1">
<em>Provide details below. <abbr class="usa-hint usa-hint--required" title="required">*</abbr></em>
<em>Name the agencies that will be involved in this initiative. <abbr class="usa-hint usa-hint--required" title="required">*</abbr></em>
</p>
{% with add_label_class="usa-sr-only" attr_required="required" attr_maxlength="2000" %}
{% input_with_errors forms.5.interagency_initiative_details %}
{% endwith %}
<p class="usa-hint margin-top-0">Maximum 2000 characters allowed.</p>
</div>
</fieldset>
{% else %}

View file

@ -111,7 +111,6 @@
<p class="margin-y-0"><span class='text-bold text-secondary-dark'>Incomplete</span></p>
{% elif domain_request.working_with_eop %}
<p class="margin-y-0">{{domain_request.eop_stakeholder_first_name}} {{domain_request.eop_stakeholder_last_name}}</p>
<p class="margin-y-0">{{domain_request.eop_stakeholder_email}}</p>
{% else %}
<p class="margin-y-0">No</p>
{% endif %}

View file

@ -6,60 +6,58 @@
{% endblock %}
{% block form_fields %}
{% if requires_feb_questions %}
{% if requires_feb_questions %}
<fieldset class="usa-fieldset">
{{forms.0.management_form}}
{{forms.1.management_form}}
{{forms.2.management_form}}
{{forms.3.management_form}}
{{forms.4.management_form}}
{{forms.5.management_form}}
<fieldset class="usa-fieldset">
<h2 class="margin-top-0 margin-bottom-0">Are you working with someone in the Executive Office of the President (EOP) on this request?</h2>
<p class="margin-bottom-0 margin-top-1">
<em>Select one. <abbr class="usa-hint usa-hint--required" title="required">*</abbr></em>
</p>
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors forms.0.working_with_eop %}
{% endwith %}
<h2 class="margin-top-0 margin-bottom-0">Are you working with someone in the Executive Office of the President (EOP) on this request?</h2>
<p class="margin-bottom-0 margin-top-1">
<em>Select one. <abbr class="usa-hint usa-hint--required" title="required">*</abbr></em>
</p>
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors forms.0.working_with_eop %}
{% endwith %}
<div id="eop-contact-container" class="conditional-panel display-none">
<p class="margin-bottom-0 margin-top-1">
Provide the name and email of the person you're working with.<span class="usa-label--required">*</span>
</p>
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors forms.1.first_name %}
{% input_with_errors forms.1.last_name %}
{% input_with_errors forms.1.email %}
{% endwith %}
</div>
<h2 class="margin-top-0 margin-bottom-0">Is there anything else you'd like us to know about your domain request?</h2>
<p class="margin-bottom-0 margin-top-1">
<em>Select one. <abbr class="usa-hint usa-hint--required" title="required">*</abbr></em>
</p>
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors forms.2.has_anything_else_text %}
{% endwith %}
<div id="anything-else-details-container" class="conditional-panel display-none">
<p class="usa-label">
<em>Provide details below <span class="usa-label--required">*</span></em>
</p>
{% with add_label_class="usa-sr-only" attr_required="required" attr_maxlength="2000" %}
{% input_with_errors forms.3.anything_else %}
{% endwith %}
</div>
</fieldset>
{% else %}
<fieldset class="usa-fieldset">
<h2 class="margin-top-0 margin-bottom-0">Is there anything else youd like us to know about your domain request?</h2>
</legend>
</fieldset>
<div id="anything-else">
<p><em>This question is optional.</em></p>
{% with attr_maxlength=2000 add_label_class="usa-sr-only" %}
{% input_with_errors forms.3.anything_else %}
{% endwith %}
<div id="eop-contact-container" class="conditional-panel display-none">
<p class="margin-bottom-0 margin-top-1">
Provide the name and email of the person you're working with.<span class="usa-label--required">*</span>
</p>
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors forms.1.first_name %}
{% input_with_errors forms.1.last_name %}
{% endwith %}
</div>
{% endif %}
<h2>Is there anything else you'd like us to know about your domain request?</h2>
<p class="margin-bottom-0 margin-top-1">
<em>Select one. <abbr class="usa-hint usa-hint--required" title="required">*</abbr></em>
</p>
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors forms.2.has_anything_else_text %}
{% endwith %}
<div id="anything-else-details-container" class="conditional-panel display-none">
<p class="usa-label">
<em>Provide details below <span class="usa-label--required">*</span></em>
</p>
{% with add_label_class="usa-sr-only" attr_required="required" attr_maxlength="2000" %}
{% input_with_errors forms.3.anything_else %}
{% endwith %}
</div>
</fieldset>
{% else %}
<fieldset class="usa-fieldset">
<h2 class="margin-top-0 margin-bottom-0">Is there anything else youd like us to know about your domain request?</h2>
</legend>
</fieldset>
<div id="anything-else">
<p><em>This question is optional.</em></p>
{% with attr_maxlength=2000 add_label_class="usa-sr-only" %}
{% input_with_errors forms.3.anything_else %}
{% endwith %}
</div>
{% endif %}
{% endblock %}

View file

@ -2063,7 +2063,6 @@ class TestDomainRequestAdmin(MockEppLib):
"working_with_eop",
"eop_stakeholder_first_name",
"eop_stakeholder_last_name",
"eop_stakeholder_email",
"purpose",
"has_timeframe",
"time_frame_details",

View file

@ -2648,7 +2648,6 @@ class DomainRequestTests(TestWithUser, WebTest):
additional_details_form["portfolio_additional_details-working_with_eop"] = "True"
additional_details_form["portfolio_additional_details-first_name"] = "TesterFirstName"
additional_details_form["portfolio_additional_details-last_name"] = "TesterLastName"
additional_details_form["portfolio_additional_details-email"] = "testy@town.com"
additional_details_form["portfolio_additional_details-has_anything_else_text"] = "True"
additional_details_form["portfolio_additional_details-anything_else"] = "test"
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
@ -2761,7 +2760,6 @@ class DomainRequestTests(TestWithUser, WebTest):
# EOP Stakeholder
self.assertContains(review_page, "EOP Stakeholder")
self.assertContains(review_page, "TesterFirstName TesterLastName")
self.assertContains(review_page, "testy@town.com")
@less_console_noise_decorator
def test_domain_request_formsets(self):

View file

@ -1898,7 +1898,6 @@ class DomainRequestExport(BaseExport):
"Target time frame": model.get("time_frame_details", None),
"Interagency initiative": model.get("interagency_initiative_details", None),
"EOP stakeholder name": eop_stakeholder_name,
"EOP stakeholder email": model.get("eop_stakeholder_email", None),
}
row = [FIELDS.get(column, "") for column in columns]

View file

@ -625,6 +625,11 @@ class PortfolioAdditionalDetails(DomainRequestWizard):
2: FEBAnythingElseYesNoForm
3: PortfolioAnythingElseForm
"""
if not self.requires_feb_questions():
for i in range(3):
forms[i].mark_form_for_deletion()
# If FEB questions aren't required, validate only the anything else form
return forms[3].is_valid()
eop_forms_valid = True
if not forms[0].is_valid():
# If the user isn't working with EOP, don't validate the EOP contact form