Django rest framework django rest框架的权限类问题

Django rest framework django rest框架的权限类问题,django-rest-framework,Django Rest Framework,我做了一个简单的项目来测试权限类,但它不起作用。 当我全局定义这些权限类时,它就工作了,但当我试图定义它的类级别时,它就不工作了。 我检查了很多次,但都不起作用 然后我检查兼容性问题,但我不明白 我正在使用python 3.8.2 Django=2.2.5` drf版本是3.11 我不知道问题出在哪里 from django.shortcuts import render from testapp.models import Employee from testapp.s

我做了一个简单的项目来测试权限类,但它不起作用。 当我全局定义这些权限类时,它就工作了,但当我试图定义它的类级别时,它就不工作了。 我检查了很多次,但都不起作用 然后我检查兼容性问题,但我不明白 我正在使用python 3.8.2 Django=2.2.5` drf版本是3.11
我不知道问题出在哪里

    from django.shortcuts import render
    from testapp.models import Employee
    from testapp.serializers import EmployeeSerializer
    from rest_framework.viewsets import ModelViewSet
    from rest_framework.authentication import TokenAuthentication
    from rest_framework.permissions import IsAuthenticated,AllowAny,IsAuthenticatedOrReadOnly
    from testapp.permissions import IsReadOnly
    from rest_framework_jwt.authentication import JSONWebTokenAuthentication
    from rest_framework_simplejwt.views import TokenObtainPairView,TokenRefreshView

# Create your views here.
class EmployeeCRUDCBV(ModelViewSet):
    queryset=Employee.objects.all()
    serializer_class=EmployeeSerializer
    # authentication_classes=[TokenAuthentication,]
    authentication_classes=[TokenObtainPairView,]
    # permissions_classes=[IsAuthenticatedOrReadOnly,]
    permissions_classes=[IsAuthenticated,]

“权限”类不是“权限”,您有输入错误^_^

例如:
'permission'类不是'permissions',您有输入错误^_^

例如:

您所说的“全局”或“类级别”是什么意思?您所说的“全局”或“类级别”是什么意思?感谢bro的答复。这也是一个问题,但也存在一些兼容性问题。感谢bro的答复。这也是一个问题,但也存在一些兼容性问题。