Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model_form doesn't validate StringField's inside ListField #56

Open
adamlwgriffiths opened this issue Jun 5, 2013 · 1 comment
Open
Labels
type: bug Something isn't working

Comments

@adamlwgriffiths
Copy link

I have the following inside a document class

tags = db.ListField(db.StringField(max_length=30, min_length=1), required=True)

I use the model_form to create the form.

If I send back a tag field with no content the form.validate() function should return False.
Instead, the function is returning True.
It is then left to Mongo to pick up the validation error and throw an exception.

ValidationError (Post:51ad4c74c47f3e07507984f4) (3.String value is too short: ['tags'])

The form.validate() function should validate the contents of ListField's.

@lafrech
Copy link
Member

lafrech commented Feb 23, 2016

I pushed a branch with a test for this:

https://github.com/MongoEngine/flask-mongoengine/tree/listfield_validation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants