diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index cbdb29579..a1842c911 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -33,7 +33,7 @@ class RegistrarForm(forms.Form): # save a reference to an application object self.application = kwargs.pop("application", None) super(RegistrarForm, self).__init__(*args, **kwargs) - + def to_database(self, obj: DomainApplication | Contact): """ Adds this form's cleaned data to `obj` and saves `obj`. @@ -329,7 +329,7 @@ class AboutYourOrganizationForm(RegistrarForm): class AuthorizingOfficialForm(RegistrarForm): JOIN = "authorizing_official" - + def to_database(self, obj): if not self.is_valid(): return diff --git a/src/registrar/forms/domain.py b/src/registrar/forms/domain.py index 4db714b5c..eabfba6b0 100644 --- a/src/registrar/forms/domain.py +++ b/src/registrar/forms/domain.py @@ -26,6 +26,7 @@ import re logger = logging.getLogger(__name__) + class DomainAddUserForm(forms.Form): """Form for adding a user to a domain.""" @@ -212,6 +213,7 @@ class ContactForm(forms.ModelForm): class AuthorizingOfficialContactForm(ContactForm): """Form for updating authorizing official contacts.""" + JOIN = "authorizing_official" def __init__(self, *args, **kwargs): diff --git a/src/registrar/models/contact.py b/src/registrar/models/contact.py index 02f13114f..d5d673b32 100644 --- a/src/registrar/models/contact.py +++ b/src/registrar/models/contact.py @@ -68,7 +68,7 @@ class Contact(TimeStampedModel): "contact_applications_information", ] return any(self._has_more_than_one_join_per_relation(rel, expected_relation) for rel in all_relations) - + def _has_more_than_one_join_per_relation(self, relation, expected_relation): """Helper for finding whether an object is joined more than once.""" # threshold is the number of related objects that are acceptable @@ -96,7 +96,7 @@ class Contact(TimeStampedModel): # the threshold return getattr(self, relation).count() > threshold return False - + def get_formatted_name(self): """Returns the contact's name in Western order.""" names = [n for n in [self.first_name, self.middle_name, self.last_name] if n]