serializers.py 文件源码

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

项目:munch-core 作者: crunchmail 项目源码 文件源码
def is_partly_invalid(self):
        """ Allows to have a multiple serializer (many=True) with part of the
            raise serializers data valid and part of the data invalid.
        """
        assert hasattr(self, 'initial_data'), (
            'Cannot call `.is_partly_valid()`no `data=` keyword argument was'
            'passed when instantiating the serializer instance.'
        )
        has_errors = False

        # this one may trigger a ValidationError up to http client
        self.run_list_size_validation(self.initial_data)

        # those can't, from here, validation is always considered good
        if not hasattr(self, '_validated_data'):
            self._validated_data, exc = self.run_partial_validation(
                self.initial_data)
            self._partial_errors = exc.detail
            if exc.detail:
                has_errors = True

        # partly valid if at least something is valid
        return has_errors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号