Permissions for CreateAPIView in Django Rest Framework
问题 I looked at the code for CreateAPIView and nowhere in the creation process are permissions checked. So I decided to check them in the perform_create hook as follows: class CourseList(generics.CreateAPIView): """ Create a course. A user can create a course if he/she is an instructor in the academy the course is to be created in. """ serializer_class = CourseRef queryset = Course.objects.all() permission_classes = (IsAuthenticated, IsInstructorInAcademy) def perform_create(self, serializer):