From 36f3d3e8a909588b06ea5efc1e78e6e1c2e4ee0a Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Mon, 16 Dec 2024 10:25:25 -0600
Subject: [PATCH 01/14] add warning to domain requests when status cannot be
changed
---
src/registrar/admin.py | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index 0e8e4847a..5e8148664 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2543,6 +2543,31 @@ def get_queryset(self, request):
# Further filter the queryset by the portfolio
qs = qs.filter(portfolio=portfolio_id)
return qs
+
+ def change_view(self, request, object_id, form_url="", extra_context=None):
+ """Extend the change_view for DomainRequest objects in django admin.
+ Customize to display notification that statu cannot be changed from 'Approved'."""
+
+ # Fetch the Contact instance
+ domain_request: models.DomainRequest = models.DomainRequest.objects.get(pk=object_id)
+ if domain_request.approved_domain and domain_request.approved_domain.state == models.Domain.State.READY:
+ domain = domain_request.approved_domain
+ # get change url for domain
+ app_label = domain_request.approved_domain._meta.app_label
+ model_name = domain._meta.model_name
+ obj_id = domain.id
+ change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
+
+ message += f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa
+ message += f"{domain}
"
+
+ message_html = mark_safe(message) # nosec
+ messages.warning(
+ request,
+ message_html,
+ )
+
+ return super().change_view(request, object_id, form_url, extra_context=extra_context)
class TransitionDomainAdmin(ListHeaderAdmin):
From ead90c15411ac2f9d1cadc478bc85992642b4e7a Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Mon, 16 Dec 2024 14:11:42 -0600
Subject: [PATCH 02/14] tests for approved domain warning
---
src/registrar/admin.py | 50 ++++++++++-------------
src/registrar/tests/test_admin_request.py | 38 ++++++++++++++++-
2 files changed, 59 insertions(+), 29 deletions(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index 5e8148664..ce3b0220c 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2429,8 +2429,28 @@ def changelist_view(self, request, extra_context=None):
return response
def change_view(self, request, object_id, form_url="", extra_context=None):
- """Display restricted warning,
- Setup the auditlog trail and pass it in extra context."""
+ """Display restricted warning, setup the auditlog trail and pass it in extra context,
+ display warning that status cannot be changed from 'Approved' if domain is in Ready state"""
+
+ # Fetch the Contact instance
+ domain_request: models.DomainRequest = models.DomainRequest.objects.get(pk=object_id)
+ if domain_request.approved_domain and domain_request.approved_domain.state == models.Domain.State.READY:
+ domain = domain_request.approved_domain
+ # get change url for domain
+ app_label = domain_request.approved_domain._meta.app_label
+ model_name = domain._meta.model_name
+ obj_id = domain.id
+ change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
+
+ message = f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa
+ message += f"{domain}"
+
+ message_html = mark_safe(message) # nosec
+ messages.warning(
+ request,
+ message_html,
+ )
+
obj = self.get_object(request, object_id)
self.display_restricted_warning(request, obj)
@@ -2543,32 +2563,6 @@ def get_queryset(self, request):
# Further filter the queryset by the portfolio
qs = qs.filter(portfolio=portfolio_id)
return qs
-
- def change_view(self, request, object_id, form_url="", extra_context=None):
- """Extend the change_view for DomainRequest objects in django admin.
- Customize to display notification that statu cannot be changed from 'Approved'."""
-
- # Fetch the Contact instance
- domain_request: models.DomainRequest = models.DomainRequest.objects.get(pk=object_id)
- if domain_request.approved_domain and domain_request.approved_domain.state == models.Domain.State.READY:
- domain = domain_request.approved_domain
- # get change url for domain
- app_label = domain_request.approved_domain._meta.app_label
- model_name = domain._meta.model_name
- obj_id = domain.id
- change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
-
- message += f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa
- message += f"{domain}
"
-
- message_html = mark_safe(message) # nosec
- messages.warning(
- request,
- message_html,
- )
-
- return super().change_view(request, object_id, form_url, extra_context=extra_context)
-
class TransitionDomainAdmin(ListHeaderAdmin):
"""Custom transition domain admin class."""
diff --git a/src/registrar/tests/test_admin_request.py b/src/registrar/tests/test_admin_request.py
index df0902719..d744dd00a 100644
--- a/src/registrar/tests/test_admin_request.py
+++ b/src/registrar/tests/test_admin_request.py
@@ -25,6 +25,8 @@
Portfolio,
AllowedEmail,
)
+from registrar.models.host import Host
+from registrar.models.public_contact import PublicContact
from .common import (
MockSESClient,
completed_domain_request,
@@ -36,7 +38,7 @@
MockEppLib,
GenericTestHelper,
)
-from unittest.mock import patch
+from unittest.mock import ANY, patch
from django.conf import settings
import boto3_mocking # type: ignore
@@ -76,6 +78,8 @@ def setUpClass(self):
def tearDown(self):
super().tearDown()
+ Host.objects.all().delete()
+ PublicContact.objects.all().delete()
Domain.objects.all().delete()
DomainInformation.objects.all().delete()
DomainRequest.objects.all().delete()
@@ -91,6 +95,7 @@ def tearDownClass(self):
User.objects.all().delete()
AllowedEmail.objects.all().delete()
+
@less_console_noise_decorator
def test_domain_request_senior_official_is_alphabetically_sorted(self):
"""Tests if the senior offical dropdown is alphanetically sorted in the django admin display"""
@@ -1810,6 +1815,37 @@ def test_change_view_with_restricted_creator(self):
request,
"Cannot edit a domain request with a restricted creator.",
)
+
+ # @less_console_noise_decorator
+ def test_approved_domain_request_with_ready_domain_has_warning_message(self):
+ """Tests if the domain request has a warning message when the approved domain is in Ready state"""
+ # Create an instance of the model
+ domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
+ # Approve the domain request
+ domain_request.approve()
+ domain_request.save()
+
+ # Add nameservers to get to Ready state
+ domain_request.approved_domain.nameservers = [
+ ("ns1.city.gov", ["1.1.1.1"]),
+ ("ns2.city.gov", ["1.1.1.2"]),
+ ]
+ domain_request.approved_domain.save()
+
+ with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
+ with patch("django.contrib.messages.warning") as mock_warning:
+ # Create a request object
+ self.client.force_login(self.superuser)
+ self.client.get(
+ "/admin/registrar/domainrequest/{}/change/".format(domain_request.pk),
+ follow=True,
+ )
+
+ # Assert that the error message was called with the correct argument
+ mock_warning.assert_called_once_with(
+ ANY, # don't care about the request argument
+ "The status of this domain request cannot be changed because it has been joined to a domain in Ready status: city.gov" # care about this message
+ )
def trigger_saving_approved_to_another_state(self, domain_is_active, another_state, rejection_reason=None):
"""Helper method that triggers domain request state changes from approved to another state,
From ec39b159ecfffb7786b2530ce127037084edee68 Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Mon, 16 Dec 2024 14:19:12 -0600
Subject: [PATCH 03/14] make test less brittle
---
src/registrar/tests/test_admin_request.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/registrar/tests/test_admin_request.py b/src/registrar/tests/test_admin_request.py
index d744dd00a..bbf6c1923 100644
--- a/src/registrar/tests/test_admin_request.py
+++ b/src/registrar/tests/test_admin_request.py
@@ -1844,7 +1844,7 @@ def test_approved_domain_request_with_ready_domain_has_warning_message(self):
# Assert that the error message was called with the correct argument
mock_warning.assert_called_once_with(
ANY, # don't care about the request argument
- "The status of this domain request cannot be changed because it has been joined to a domain in Ready status: city.gov" # care about this message
+ f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: {domain_request.approved_domain.name}", # noqa
)
def trigger_saving_approved_to_another_state(self, domain_is_active, another_state, rejection_reason=None):
From 86960b3068a44ace232e3d00b3e2ea42872e8081 Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Mon, 16 Dec 2024 14:27:04 -0600
Subject: [PATCH 04/14] remove conditional third buller on dotgov domain step
of domain request
---
src/registrar/templates/domain_request_dotgov_domain.html | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/registrar/templates/domain_request_dotgov_domain.html b/src/registrar/templates/domain_request_dotgov_domain.html
index 6c62c6497..38347ad96 100644
--- a/src/registrar/templates/domain_request_dotgov_domain.html
+++ b/src/registrar/templates/domain_request_dotgov_domain.html
@@ -6,11 +6,7 @@
- Be available
- Relate to your organization’s name, location, and/or services
- {% if portfolio %}
- - Be clear to the general public. Your domain name must not be easily confused with other organizations.
- {% else %}
- Be unlikely to mislead or confuse the general public (even if your domain is only intended for a specific audience)
- {% endif %}
From 24354fd7f12ee89db24c73162c3f979c31f653d3 Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Tue, 17 Dec 2024 13:03:22 -0600
Subject: [PATCH 05/14] linter fixes
---
src/registrar/admin.py | 5 +++--
src/registrar/tests/test_admin_request.py | 5 ++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index ce3b0220c..c04975cb9 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2442,7 +2442,7 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
obj_id = domain.id
change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
- message = f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa
+ message = f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa
message += f"{domain}"
message_html = mark_safe(message) # nosec
@@ -2450,7 +2450,7 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
request,
message_html,
)
-
+
obj = self.get_object(request, object_id)
self.display_restricted_warning(request, obj)
@@ -2564,6 +2564,7 @@ def get_queryset(self, request):
qs = qs.filter(portfolio=portfolio_id)
return qs
+
class TransitionDomainAdmin(ListHeaderAdmin):
"""Custom transition domain admin class."""
diff --git a/src/registrar/tests/test_admin_request.py b/src/registrar/tests/test_admin_request.py
index bbf6c1923..e109d3f96 100644
--- a/src/registrar/tests/test_admin_request.py
+++ b/src/registrar/tests/test_admin_request.py
@@ -95,7 +95,6 @@ def tearDownClass(self):
User.objects.all().delete()
AllowedEmail.objects.all().delete()
-
@less_console_noise_decorator
def test_domain_request_senior_official_is_alphabetically_sorted(self):
"""Tests if the senior offical dropdown is alphanetically sorted in the django admin display"""
@@ -1815,7 +1814,7 @@ def test_change_view_with_restricted_creator(self):
request,
"Cannot edit a domain request with a restricted creator.",
)
-
+
# @less_console_noise_decorator
def test_approved_domain_request_with_ready_domain_has_warning_message(self):
"""Tests if the domain request has a warning message when the approved domain is in Ready state"""
@@ -1834,7 +1833,7 @@ def test_approved_domain_request_with_ready_domain_has_warning_message(self):
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
with patch("django.contrib.messages.warning") as mock_warning:
- # Create a request object
+ # Create a request object
self.client.force_login(self.superuser)
self.client.get(
"/admin/registrar/domainrequest/{}/change/".format(domain_request.pk),
From f277efc6c43adf072ebe26091c50e66ffbcaf8c3 Mon Sep 17 00:00:00 2001
From: Matt-Spence
Date: Mon, 23 Dec 2024 14:57:37 -0600
Subject: [PATCH 06/14] Update src/registrar/admin.py
Co-authored-by: zandercymatics <141044360+zandercymatics@users.noreply.github.com>
---
src/registrar/admin.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index c04975cb9..117f689f8 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2442,10 +2442,12 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
obj_id = domain.id
change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
- message = f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa
- message += f"{domain}"
-
- message_html = mark_safe(message) # nosec
+message = format_html(
+ "The status of this domain request cannot be changed because it has been joined to a domain in Ready status:"
+ "{}",
+ mark_safe(change_url),
+ escape(str(domain))
+)
messages.warning(
request,
message_html,
From ee2bff6492d87ccccc0e1ddbb1f0948f7a885108 Mon Sep 17 00:00:00 2001
From: Matthew Spence
Date: Mon, 23 Dec 2024 15:31:04 -0600
Subject: [PATCH 07/14] fix warning html
---
src/registrar/admin.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index 117f689f8..c5aae7d2d 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2442,16 +2442,16 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
obj_id = domain.id
change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
-message = format_html(
- "The status of this domain request cannot be changed because it has been joined to a domain in Ready status:"
- "{}",
- mark_safe(change_url),
- escape(str(domain))
-)
- messages.warning(
- request,
- message_html,
- )
+ message = format_html(
+ "The status of this domain request cannot be changed because it has been joined to a domain in Ready status:"
+ "{}",
+ mark_safe(change_url),
+ escape(str(domain))
+ )
+ messages.warning(
+ request,
+ message,
+ )
obj = self.get_object(request, object_id)
self.display_restricted_warning(request, obj)
From 887a9dfc3318a037b01520cbf474893b66548ab0 Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Mon, 30 Dec 2024 10:18:08 -0600
Subject: [PATCH 08/14] linter changes
---
src/registrar/admin.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index 2b58cb5fc..bbebbdb80 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2632,10 +2632,10 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
message = format_html(
- "The status of this domain request cannot be changed because it has been joined to a domain in Ready status:"
+ "The status of this domain request cannot be changed because it has been joined to a domain in Ready status:" # noqa: E501
"{}",
- mark_safe(change_url),
- escape(str(domain))
+ mark_safe(change_url), # nosec
+ escape(str(domain)),
)
messages.warning(
request,
From 7fd5bacb0394322c86bc9d3c7b283fb648f03c1e Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Tue, 31 Dec 2024 11:11:24 -0600
Subject: [PATCH 09/14] fix broken test
---
src/registrar/admin.py | 2 +-
src/registrar/tests/test_admin_request.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index bbebbdb80..e319daac0 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2632,7 +2632,7 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
message = format_html(
- "The status of this domain request cannot be changed because it has been joined to a domain in Ready status:" # noqa: E501
+ "The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa: E501
"{}",
mark_safe(change_url), # nosec
escape(str(domain)),
diff --git a/src/registrar/tests/test_admin_request.py b/src/registrar/tests/test_admin_request.py
index 8ec63b9d9..6c7d898c7 100644
--- a/src/registrar/tests/test_admin_request.py
+++ b/src/registrar/tests/test_admin_request.py
@@ -1812,7 +1812,7 @@ def test_change_view_with_restricted_creator(self):
"Cannot edit a domain request with a restricted creator.",
)
- # @less_console_noise_decorator
+ @less_console_noise_decorator
def test_approved_domain_request_with_ready_domain_has_warning_message(self):
"""Tests if the domain request has a warning message when the approved domain is in Ready state"""
# Create an instance of the model
@@ -1840,7 +1840,7 @@ def test_approved_domain_request_with_ready_domain_has_warning_message(self):
# Assert that the error message was called with the correct argument
mock_warning.assert_called_once_with(
ANY, # don't care about the request argument
- f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: {domain_request.approved_domain.name}", # noqa
+ f"The status of this domain request cannot be changed because it has been joined to a domain in Ready status: {domain_request.approved_domain.name}", # noqa
)
def trigger_saving_approved_to_another_state(self, domain_is_active, another_state, rejection_reason=None):
From 465e41abc57fa55c05a21b6352635ff561debe55 Mon Sep 17 00:00:00 2001
From: matthewswspence
Date: Tue, 31 Dec 2024 14:30:28 -0600
Subject: [PATCH 10/14] fix spacing causing admin bug
---
src/registrar/admin.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index e319daac0..7b04f3e9d 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2631,16 +2631,16 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
obj_id = domain.id
change_url = reverse("admin:%s_%s_change" % (app_label, model_name), args=[obj_id])
- message = format_html(
- "The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa: E501
- "{}",
- mark_safe(change_url), # nosec
- escape(str(domain)),
- )
- messages.warning(
- request,
- message,
- )
+ message = format_html(
+ "The status of this domain request cannot be changed because it has been joined to a domain in Ready status: " # noqa: E501
+ "{}",
+ mark_safe(change_url), # nosec
+ escape(str(domain)),
+ )
+ messages.warning(
+ request,
+ message,
+ )
obj = self.get_object(request, object_id)
self.display_restricted_warning(request, obj)
From 6119b39a599da9fea2564ad64eeedf016d4bff56 Mon Sep 17 00:00:00 2001
From: Matthew Spence
Date: Tue, 31 Dec 2024 15:26:30 -0600
Subject: [PATCH 11/14] fix comment
---
src/registrar/admin.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index 8afc2d97f..808d1b557 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -2621,7 +2621,7 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
"""Display restricted warning, setup the auditlog trail and pass it in extra context,
display warning that status cannot be changed from 'Approved' if domain is in Ready state"""
- # Fetch the Contact instance
+ # Fetch the domain request instance
domain_request: models.DomainRequest = models.DomainRequest.objects.get(pk=object_id)
if domain_request.approved_domain and domain_request.approved_domain.state == models.Domain.State.READY:
domain = domain_request.approved_domain
From 0eeee88f1c79b426049cfc40d69a2ce9b2c2715d Mon Sep 17 00:00:00 2001
From: David Kennedy
Date: Thu, 2 Jan 2025 11:40:17 -0500
Subject: [PATCH 12/14] hide 'other' for portfolios without suborganizations
---
src/registrar/assets/src/js/getgov/requesting-entity.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/registrar/assets/src/js/getgov/requesting-entity.js b/src/registrar/assets/src/js/getgov/requesting-entity.js
index 4e7cf8276..2f8c842a7 100644
--- a/src/registrar/assets/src/js/getgov/requesting-entity.js
+++ b/src/registrar/assets/src/js/getgov/requesting-entity.js
@@ -26,7 +26,12 @@ export function handleRequestingEntityFieldset() {
function toggleSuborganization(radio=null) {
if (radio != null) requestingSuborganization = radio?.checked && radio.value === "True";
requestingSuborganization ? showElement(suborgContainer) : hideElement(suborgContainer);
- requestingNewSuborganization.value = requestingSuborganization && select.value === "other" ? "True" : "False";
+ if (select.options.length == 2) { // --Select-- and other are the only options
+ hideElement(selectParent); // Hide the select drop down and indicate requesting new suborg
+ requestingNewSuborganization.value = "True";
+ } else {
+ requestingNewSuborganization.value = requestingSuborganization && select.value === "other" ? "True" : "False";
+ }
requestingNewSuborganization.value === "True" ? showElement(suborgDetailsContainer) : hideElement(suborgDetailsContainer);
}
From ce94775879543897bd924da6b5d9122c221605a5 Mon Sep 17 00:00:00 2001
From: David Kennedy
Date: Thu, 2 Jan 2025 20:34:34 -0500
Subject: [PATCH 13/14] minor changes to content
---
src/registrar/assets/src/js/getgov/requesting-entity.js | 2 ++
src/registrar/forms/domain_request_wizard.py | 3 ++-
.../templates/domain_request_requesting_entity.html | 5 +++--
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/registrar/assets/src/js/getgov/requesting-entity.js b/src/registrar/assets/src/js/getgov/requesting-entity.js
index 2f8c842a7..3bcdcd35c 100644
--- a/src/registrar/assets/src/js/getgov/requesting-entity.js
+++ b/src/registrar/assets/src/js/getgov/requesting-entity.js
@@ -13,6 +13,7 @@ export function handleRequestingEntityFieldset() {
const selectParent = select?.parentElement;
const suborgContainer = document.getElementById("suborganization-container");
const suborgDetailsContainer = document.getElementById("suborganization-container__details");
+ const suborgAddtlInstruction = document.getElementById("suborganization-addtl-instruction");
const subOrgCreateNewOption = document.getElementById("option-to-add-suborg")?.value;
// Make sure all crucial page elements exist before proceeding.
// This more or less ensures that we are on the Requesting Entity page, and not elsewhere.
@@ -28,6 +29,7 @@ export function handleRequestingEntityFieldset() {
requestingSuborganization ? showElement(suborgContainer) : hideElement(suborgContainer);
if (select.options.length == 2) { // --Select-- and other are the only options
hideElement(selectParent); // Hide the select drop down and indicate requesting new suborg
+ hideElement(suborgAddtlInstruction); // Hide additional instruction related to the list
requestingNewSuborganization.value = "True";
} else {
requestingNewSuborganization.value = requestingSuborganization && select.value === "other" ? "True" : "False";
diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/domain_request_wizard.py
index 289b3da0b..130a61e90 100644
--- a/src/registrar/forms/domain_request_wizard.py
+++ b/src/registrar/forms/domain_request_wizard.py
@@ -144,9 +144,10 @@ def __init__(self, *args, **kwargs):
"""Extend the initialization of the form from RegistrarForm __init__"""
super().__init__(*args, **kwargs)
if self.domain_request.portfolio:
+ choose_text = "(choose from list)" if self.domain_request.portfolio.portfolio_suborganizations.exists() else ""
self.form_choices = (
(False, self.domain_request.portfolio),
- (True, "A suborganization (choose from list)"),
+ (True, f"A suborganization {choose_text}"),
)
self.fields[self.field_name] = self.get_typed_choice_field()
diff --git a/src/registrar/templates/domain_request_requesting_entity.html b/src/registrar/templates/domain_request_requesting_entity.html
index 9ed83f2d0..d889a8f44 100644
--- a/src/registrar/templates/domain_request_requesting_entity.html
+++ b/src/registrar/templates/domain_request_requesting_entity.html
@@ -38,8 +38,9 @@ Who will use the domain you’re requesting?
Add suborganization information
- This information will be published in .gov’s public data. If you don’t see your suborganization in the list,
- select “other.”
+ This information will be published in .gov’s public data.
+ If you don’t see your suborganization in the list,
+ select “other.”
{% with attr_required=True %}
{% input_with_errors forms.1.sub_organization %}
From 560a07f67335ccbeca1b1ffb8d83c98159d5fb13 Mon Sep 17 00:00:00 2001
From: David Kennedy
Date: Thu, 2 Jan 2025 20:38:11 -0500
Subject: [PATCH 14/14] lint
---
src/registrar/forms/domain_request_wizard.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/domain_request_wizard.py
index 130a61e90..38ddc2851 100644
--- a/src/registrar/forms/domain_request_wizard.py
+++ b/src/registrar/forms/domain_request_wizard.py
@@ -144,7 +144,9 @@ def __init__(self, *args, **kwargs):
"""Extend the initialization of the form from RegistrarForm __init__"""
super().__init__(*args, **kwargs)
if self.domain_request.portfolio:
- choose_text = "(choose from list)" if self.domain_request.portfolio.portfolio_suborganizations.exists() else ""
+ choose_text = (
+ "(choose from list)" if self.domain_request.portfolio.portfolio_suborganizations.exists() else ""
+ )
self.form_choices = (
(False, self.domain_request.portfolio),
(True, f"A suborganization {choose_text}"),