From 1851f83480d21e55a64f9c87db136c32f13240fc Mon Sep 17 00:00:00 2001 From: Neil Martinsen-Burrell Date: Thu, 1 Jun 2023 12:08:40 -0500 Subject: [PATCH] Change your contact information to refer to logged-in user --- src/registrar/tests/test_views.py | 7 +++---- src/registrar/views/domain.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 28465de02..a836f87e8 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -1309,10 +1309,9 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest): self.assertContains(page, "Domain contact information") def test_domain_your_contact_information_content(self): - """Your contact information appears on the page.""" - self.domain_information.submitter = Contact(first_name="Testy") - self.domain_information.submitter.save() - self.domain_information.save() + """Logged-in user's contact information appears on the page.""" + self.user.contact.first_name = "Testy" + self.user.contact.save() page = self.app.get( reverse("domain-your-contact-information", kwargs={"pk": self.domain.id}) ) diff --git a/src/registrar/views/domain.py b/src/registrar/views/domain.py index d101b46b7..cc3f79809 100644 --- a/src/registrar/views/domain.py +++ b/src/registrar/views/domain.py @@ -115,7 +115,7 @@ class DomainYourContactInformationView(DomainPermissionView, FormMixin): def get_form_kwargs(self, *args, **kwargs): """Add domain_info.submitter instance to make a bound form.""" form_kwargs = super().get_form_kwargs(*args, **kwargs) - form_kwargs["instance"] = self.get_object().domain_info.submitter + form_kwargs["instance"] = self.request.user.contact return form_kwargs def get_success_url(self):