Repository: cisagov/manage.get.gov

Issue:
Django Admin: Protect the link between Domain and Domain Application from being changed
### Issue description

1) Currently, on the “Change **domain information**” page, there's a dropdown to change the linked “domain application.” This should—in theory—never need to be changed and could have serious implications if it is changed. Therefore, we need to prevent editing this field.

2) Similarly, on the "Change **domain application**" page, there's a dropdown to change the linked “approved domain.” This could also have serious implications if changed.

**Field on "Change domain information" page:**
  
![Image](https://github.com/cisagov/manage.get.gov/assets/62573986/605ba2e2-69af-4b54-bb2e-2473f6ea039a)

**Field on "Change domain application" page:**
  
![Screenshot 2023-12-06 at 5 45 08 PM](https://github.com/cisagov/manage.get.gov/assets/119689946/6dbceea5-4c68-46ea-bb7b-353e28a06e69)


### Acceptance criteria

- [ ] Prevent editing the "domain application" field
- [ ] Prevent editing the "approved domain" field

### Additional context

[Miro Research](https://miro.com/app/board/uXjVNZhbw-s=/?openComment=3458764569068532658)

### Links to other issues

_No response_


Discussion:
This does not seem "dangerous" and could be easiily corrected. But, should be considered again


Resolving patch:
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -677,6 +677,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
         "type_of_work",
         "more_organization_information",
         "domain",
+        "domain_application",
         "submitter",
         "no_other_contacts_rationale",
         "anything_else",
@@ -845,6 +846,7 @@ def queryset(self, request, queryset):
         "creator",
         "about_your_organization",
         "requested_domain",
+        "approved_domain",
         "alternative_domains",
         "purpose",
         "submitter",


Test patch:
diff --git a/src/registrar/tests/test_admin.py b/src/registrar/tests/test_admin.py
--- a/src/registrar/tests/test_admin.py
+++ b/src/registrar/tests/test_admin.py
@@ -632,6 +632,7 @@ def test_readonly_fields_for_analyst(self):
             "creator",
             "about_your_organization",
             "requested_domain",
+            "approved_domain",
             "alternative_domains",
             "purpose",
             "submitter",
@@ -1057,7 +1058,7 @@ def test_get_filters(self):
         self.assertContains(response, retrieved_html, count=1)
 
 
-class DomainInformationAdminTest(TestCase):
+class TestDomainInformationAdmin(TestCase):
     def setUp(self):
         """Setup environment for a mock admin user"""
         self.site = AdminSite()
@@ -1065,6 +1066,7 @@ def setUp(self):
         self.admin = DomainInformationAdmin(model=DomainInformation, admin_site=self.site)
         self.client = Client(HTTP_HOST="localhost:8080")
         self.superuser = create_superuser()
+        self.staffuser = create_user()
         self.mock_data_generator = AuditedAdminMockData()
 
         self.test_helper = GenericTestHelper(
@@ -1108,6 +1110,27 @@ def tearDown(self):
         Contact.objects.all().delete()
         User.objects.all().delete()
 
+    def test_readonly_fields_for_analyst(self):
+        """Ensures that analysts have their permissions setup correctly"""
+        request = self.factory.get("/")
+        request.user = self.staffuser
+
+        readonly_fields = self.admin.get_readonly_fields(request)
+
+        expected_fields = [
+            "creator",
+            "type_of_work",
+            "more_organization_information",
+            "domain",
+            "domain_application",
+            "submitter",
+            "no_other_contacts_rationale",
+            "anything_else",
+            "is_policy_acknowledged",
+        ]
+
+        self.assertEqual(readonly_fields, expected_fields)
+
     def test_domain_sortable(self):
         """Tests if DomainInformation sorts by domain correctly"""
         p = "adminpass"