diff --git a/src/registrar/templates/django/admin/includes/domain_request_fieldset.html b/src/registrar/templates/django/admin/includes/domain_request_fieldset.html index efd90b909..980fe0bfd 100644 --- a/src/registrar/templates/django/admin/includes/domain_request_fieldset.html +++ b/src/registrar/templates/django/admin/includes/domain_request_fieldset.html @@ -22,6 +22,18 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html) {{ contact }}{% if not forloop.last %}, {% endif %} {% endfor %} + {% elif field.field.name == "current_websites" %} + {% comment %} + The "website" model is essentially just a text field. + It is not useful to be redirected to the object definition, + rather it is more useful in this scenario to be redirected to the + actual website (as its just a plaintext string otherwise). + + This ONLY applies to analysts. For superusers, its business as usual. + {% endcomment %} + {% for website in field.contents|split:", " %} + {{ website }}{% if not forloop.last %}, {% endif %} + {% endfor %} {% else %}
{{ field.contents }}
{% endif %} diff --git a/src/registrar/tests/test_admin.py b/src/registrar/tests/test_admin.py index 970742ae3..b4b12c56f 100644 --- a/src/registrar/tests/test_admin.py +++ b/src/registrar/tests/test_admin.py @@ -1247,7 +1247,29 @@ class TestDomainRequestAdmin(MockEppLib): # Check that the page contains the link we expect. # Since the url is dynamic (populated by JS), we can test for its existence # by checking for the end tag. - expected_url = f"Testy Tester" + expected_url = "Testy Tester" + self.assertContains(response, expected_url) + + @less_console_noise_decorator + def test_other_websites_has_readonly_link(self): + """Tests if the readonly other_websites field has links""" + + # Create a fake domain request + domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + + p = "userpass" + self.client.login(username="staffuser", password=p) + response = self.client.get( + "/admin/registrar/domainrequest/{}/change/".format(domain_request.pk), + follow=True, + ) + + # Make sure the page loaded, and that we're on the right page + self.assertEqual(response.status_code, 200) + self.assertContains(response, domain_request.requested_domain.name) + + # Check that the page contains the link we expect. + expected_url = 'city.com' self.assertContains(response, expected_url) @less_console_noise_decorator