diff --git a/src/registrar/forms/domain.py b/src/registrar/forms/domain.py index 24012461c..e6fbc8fee 100644 --- a/src/registrar/forms/domain.py +++ b/src/registrar/forms/domain.py @@ -64,34 +64,3 @@ class DomainSecurityEmailForm(forms.Form): """Form for adding or editing a security email to a domain.""" security_email = forms.EmailField(label="Security email") - - -class ContactForm(forms.ModelForm): - - """Form for updating contacts.""" - - class Meta: - model = Contact - fields = ["first_name", "middle_name", "last_name", "title", "email", "phone"] - widgets = { - "first_name": forms.TextInput, - "middle_name": forms.TextInput, - "last_name": forms.TextInput, - "title": forms.TextInput, - "email": forms.EmailInput, - "phone": RegionalPhoneNumberWidget, - } - - # the database fields have blank=True so ModelForm doesn't create - # required fields by default. Use this list in __init__ to mark each - # of these fields as required - required = ["first_name", "last_name", "title", "email", "phone"] - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # take off maxlength attribute for the phone number field - # which interferes with our input_with_errors template tag - self.fields["phone"].widget.attrs.pop("maxlength", None) - - for field_name in self.required: - self.fields[field_name].required = True diff --git a/src/registrar/tests/test_forms.py b/src/registrar/tests/test_forms.py index d682d2cd2..173362943 100644 --- a/src/registrar/tests/test_forms.py +++ b/src/registrar/tests/test_forms.py @@ -281,17 +281,10 @@ class TestFormValidation(TestCase): class TestContactForm(TestCase): - def test_contact_form_email_invalid(self): form = ContactForm(data={"email": "example.net"}) - self.assertEqual( - form.errors["email"], - ["Enter a valid email address."] - ) + self.assertEqual(form.errors["email"], ["Enter a valid email address."]) def test_contact_form_email_invalid2(self): form = ContactForm(data={"email": "@"}) - self.assertEqual( - form.errors["email"], - ["Enter a valid email address."] - ) + self.assertEqual(form.errors["email"], ["Enter a valid email address."])