def populate_errors(self, resource):
for form_name, form_value in self._fields.items():
if form_name not in resource:
continue
if isinstance(form_value, FormField):
form_value.form.populate_errors(resource[form_name])
elif isinstance(form_value, FieldList):
for index, form in enumerate(form_value.entries):
form.populate_errors(resource[form_name].get(str(index), {}))
else:
# normally it's form.validate() that make this conversion
form_value.errors = list(form_value.errors)
form_value.errors.append(resource[form_name])
评论列表
文章目录