-
Notifications
You must be signed in to change notification settings - Fork 286
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
Validating List of DictType #592
Comments
I guess you should be passing data as a dictionary with field name and value. from schematics.models import Model
from schematics.types import StringType, ListType, DictType
class LearningAims(Model):
aims = ListType(DictType(StringType), required=True)
data = {"aims": [{"name": "foo"}, {"name": "bar"}]}
LearningAims(data).validate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python = 3.7.0
version = '2.1.0'
Hello
I'm getting an error when trying to validate of list of dicts.
The error is
TypeError: list indices must be integers or slices, not dict
What am I doing wrong?
The text was updated successfully, but these errors were encountered: