美文网首页
UserWarning: X is not compatible

UserWarning: X is not compatible

作者: mutang | 来源:发表于2020-12-25 15:55 被阅读0次

    出现原因:

    ​ 往往是重写了==get_query()==方法导致的

    在生成接口文档时,因为request为空,导致运行时不兼容,报的异常

    解决方法:

    def get_queryset(self):
        '''在方法里面写返回空query_set'''
            if not self.request:
                return UserInfo.objects.none()
    

    相关文章

      网友评论

          本文标题:UserWarning: X is not compatible

          本文链接:https://www.haomeiwen.com/subject/wpqinktx.html