-
-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
DateTimeField validation error #435
Comments
Thats because you're trying to validate a type string as a Datetime. The field doesn't accept the input so the form validation ends up being an empty field. |
No, the field accepts the string and transforms it to the If we change the data to the following format:
|
I could not reproduce: >>> import wtforms
>>> import werkzeug.datastructures
>>> class F(wtforms.Form):
... timestamp = wtforms.DateTimeField(validators=[wtforms.validators.DataRequired()])
>>> formdata = werkzeug.datastructures.ImmutableMultiDict({"timestamp": "asd"})
>>> F(formdata).validate()
False I could reproduce with passing data instead of formdata, but this is because >>> import wtforms
>>> class F(wtforms.Form):
... timestamp = wtforms.DateTimeField(validators=[wtforms.validators.DataRequired()])
>>> F(data=dict(timestamp='asd')).validate()
True |
Minimal working example:
Execution environment: Docker container, image based on python:3.6.
Output:
You can see there is the wrong error message. It should mention wrong date format, not the missing field.
The text was updated successfully, but these errors were encountered: