syrusakbary/Flask-SuperAdmin

Saving with an empty (not required) EmailFiled fails

mapio opened this issue · 1 comments

It seems that the bug described in MongoEngine/flask-mongoengine#44 reproduces quite similarly here.

In particular, just change to email = EmailField() line 31 in the example and you will get this error

screen shot 2013-05-03 at 10 25 21 am

which should not be (the None looks suspicious).

Fixed in flask-mongoengine by not using the TextField but a custom field type: NoneStringField that converts u"" to None:

See: https://github.com/MongoEngine/flask-mongoengine/blob/d103fdcb72b3e735609e13a39e8713d28419b154/flask_mongoengine/wtf/fields.py#L153-L163