rest_framework 中的类视图
1、APIView
继承:本身
导包地址:from rest_framework.views import APIView
使用方法:需要自己请求方法
2、ModelViewSet
继承:本身
导包地址:from rest_framework.viewsets import ModelViewSet
使用方法:写入queryset 和 serializer_class
3、mixins
导报地址:from rest_framework import mixins
使用方法:mixins.CreateModelMixin:创建数据
ListModelMixin : 获取全部数据
RetrieveModelMixin:获取单个数据
UpdateModelMixin:跟新数据 (如果使用patch需要给kwargs[‘partial’] = True)
DestroyModelMixin:删除数据
GenericAPIView: 里面由他们的公共方法