serializers.py 文件源码

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

项目:clubnet 作者: mani-shailesh 项目源码 文件源码
def validate(self, data):
        """
        Check that the user is a member of the club.
        """
        club = data['club']
        user = data['user']
        project = data['project']

        if not project.has_club_member(user):
            raise serializers.ValidationError(
                "The specified user must be a member of at least one of the "
                + "parent clubs!"
            )
        if not club.has_member(user):
            raise serializers.ValidationError(
                "The specified user must be a member of the specified club!"
            )
        return super(ProjectMembershipSerializer, self).validate(data)
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号