I have a big proble. I implemented a form which holds various fields, among which EmailFIeld must be OPTIONAL.
Here’s the model:
email = models.EmailField(max_length=50,blank=True,default='no@address.spec',
verbose_name=_('email'), help_text=_('Email'))
But when I do the validation of the form and return a JSON with the possible erorrs, I always receive:
{'errors':'Enter a valid e-mail address'}
and I want to be able to leave the email field optional. How can I do that?
As I remembered, default means that this field won’t be blank, if user do not delete specified address. So this validation error can be because of .spec, try to replace it with .com. And you can also add
null = Truein your model andrequired = Falsein form class.