09 2021 档案
摘要:如图所示,Students7View和Students6View视图函数写法一样,ModelViewSet把Students6View继承的所有类的活都干了,这个点开ModelViewSet源码就会发现发现,而ListModelMixin里有list方法,所以ModelViewSet可以使用继承类的
阅读全文
摘要:GenericAPIView : 可以使用get_serializer_class, get_queryset, get_serializer, get_object ListModelMixin : 视图函数名直接写get,post ListAPIView : ListAPIView, Creat
阅读全文
摘要:今天写基于视图子类来写视图接口遇到一个报错解决了半天,发现两个视图函数名字不能一样 因为StudentsView继承的ListAPIView和CreateAPIView不支持url参数获取数据,同理StudentView继承的RetrieveAPIView,UpdateAPIView,Destroy
阅读全文
浙公网安备 33010602011771号