I have a form like this
class NewUserForm(Form):
username = UsernameField(required=True)
password = CharField(required=True, widget=PasswordInput())
code = CharField(required=False)
email = EmailField(required=True)
And in views.py have this
if request.method == 'POST':
form = NewUserForm(request.POST)
if form.is_valid():
# Do stuff
No matter what I do EmailField never fails validation until I try and save
the user to which I get
ValidationError (User:None) (Invalid Mail-address: : ['email'])
I don't understand why this happens. If i change EmailField to CharField it
works, as in it recognizes when it's blank and throws the appropriate
ValidationError. This is extremely frustrating
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.