mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 18:25:58 +02:00
fix bug
This commit is contained in:
parent
6728826c0b
commit
ab2c097441
1 changed files with 5 additions and 0 deletions
|
@ -181,6 +181,7 @@ NameserverFormset = formset_factory(
|
|||
class ContactForm(forms.ModelForm):
|
||||
"""Form for updating contacts."""
|
||||
|
||||
email = forms.EmailField(max_length=None)
|
||||
class Meta:
|
||||
model = Contact
|
||||
fields = ["first_name", "middle_name", "last_name", "title", "email", "phone"]
|
||||
|
@ -204,6 +205,10 @@ class ContactForm(forms.ModelForm):
|
|||
# which interferes with out input_with_errors template tag
|
||||
self.fields["phone"].widget.attrs.pop("maxlength", None)
|
||||
|
||||
# Define a custom validator for the email field with a custom error message
|
||||
email_max_length_validator = MaxLengthValidator(320, message="Response must be less than 320 characters.")
|
||||
self.fields["email"].validators.append(email_max_length_validator)
|
||||
|
||||
for field_name in self.required:
|
||||
self.fields[field_name].required = True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue