In my project, on the form, I apply the built in validate_email validator on a field.
I apply it to one of my form fields, however it throws an error when I run the server.
Here is the code:
from django.core.validators import MinLengthValidator, MaxLengthValidator, validate_email
from django import forms
class SignupForm(forms.Form):
email = forms.EmailField(validators=[validate_email(value='Email wrong'), MinLengthValidator(3),
MaxLengthValidator(255)], widget=forms.EmailInput(attrs={'placeholder': 'Email Address'}))
The error I receive when server is run is:
django.core.exceptions.ValidationError: [‘Enter a valid email address.’]
However when I remove the brackets after validate_email, everything works ok, however I need them as I want to override the message value displayed. Does anybody know the issue? Thanks.