We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
python = 3.7.0 version = '2.1.0'
Hello
I'm getting an error when trying to validate of list of dicts.
class LearningAims(Model): aims = ListType(DictType(StringType), required=True) data = [{"name": "foo"}, {"name": "bar"}] LearningAims(data).validate()
The error is TypeError: list indices must be integers or slices, not dict
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:
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()
Sorry, something went wrong.
No branches or pull requests
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: