form.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:wazo-admin-ui 作者: wazo-pbx 项目源码 文件源码
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])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号