热门标签
更多>
搜索结果
查询Tags标签: ViewSetMixin,共有 2条记录-
继承ViewSetMixin的视图类
from rest_framework.viewsets import ViewSetMixin class Book6View(ViewSetMixin,APIView): #一定要放在APIVIew前def get_all_book(self,request):print("xxxx")book_list = Book.objects.all()book_ser = BookSerializer(book_list, many=True)return Respo…
2022/4/6 6:20:40 人评论 次浏览 -
模型类序列化器的几个类
GenericAPIView 实现通用的数据库查询和序列化在类中定义:queryset = Book.objectsserializer_class = myserializersmod.BookModelSerializer自己需要实现get post put delete 方法 好处是写法都是差不多的 ListModelMixin RetrieveModelMixin UpdateModelMixin等等 …
2022/4/4 6:19:06 人评论 次浏览