array.py 文件源码

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

项目:django 作者: alexsukhrin 项目源码 文件源码
def check(self, **kwargs):
        errors = super(ArrayField, self).check(**kwargs)
        if self.base_field.remote_field:
            errors.append(
                checks.Error(
                    'Base field for array cannot be a related field.',
                    obj=self,
                    id='postgres.E002'
                )
            )
        else:
            # Remove the field name checks as they are not needed here.
            base_errors = self.base_field.check()
            if base_errors:
                messages = '\n    '.join('%s (%s)' % (error.msg, error.id) for error in base_errors)
                errors.append(
                    checks.Error(
                        'Base field for array has errors:\n    %s' % messages,
                        obj=self,
                        id='postgres.E001'
                    )
                )
        return errors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号