rest_framework中的继承顺序
rest_framework中APIView、GenericAPIView、5个视图扩展类、9个子类视图、ModelViewSet、ViewSet、ViewSetMixin的继承顺序
APIView(重写了as_view、局部取消了csrf认证, 继承View)
ViewSetMixin(重写了as_view,局部取消了csrf认证,继承object)
GenericAPIView(queryset属性、serializer_class属性,继承APIView)
5个视图扩展类(均继承object)
1)ListModelMixin:lsit查询多条
2)CreateModelMixin:create新增一条
3)UpdateModelMixin:update修改一条
4)RetrieveModelMixin:retrieve查询一条
5)DestroyModelMixin:destroy删除一条
9个子类视图(均继承GenericAPIView)
1)ListAPIView:查所有,继承GenericAPIView、ListModelMixin
2)CreateAPIView:新增一条,继承GenericAPIView、CreateModelMixin
3)RetrieveAPIView:查一条,继承GenericAPIView、RetrieveModelMixin
4)UpdateAPIView:修改一条,继承GenericAPIView、UpdateModelMixin
5)DestroyAPIView:删一条,继承GenericAPIView、DestroyModelMixin
6)ListCreateAPIView:查所有、新增一条,继承GenericAPIView、ListModelMixin、CreateModelMixin
7)RetrieveDestroyAPIView:查一条、删一条,继承GenericAPIView、RetrieveModelMixin、DestroyModelMixin
8)RetrieveUpdateAPIView:查一条、改一条,继承GenericAPIView、RetrieveModelMixin、UpdateModelMixin
9)RetrieveUpdateDestroyAPIView:查一条、改一条、删一条,继承GenericAPIView、RetrieveModelMixin、UpdateModelMixin、DestroyModelMixin