Cannot apply DjangoModelPermissionsOrAnonReadOnly on a view that does not set `.queryset` or have a `.get_queryset()` method.

使用 Django Rest Framework 时,遇到报错:

Cannot apply DjangoModelPermissionsOrAnonReadOnly on a view that does not set `.queryset` or have a `.get_queryset()` method.

 

将 setting.py文件的权限检查配置注释了,这个问题就没了

    # 'DEFAULT_PERMISSION_CLASSES': [
    #     'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
    # ],

 

 

posted @ 2021-03-25 16:40  北斗星君  阅读(264)  评论(0编辑  收藏  举报