zoukankan      html  css  js  c++  java
  • rest_framework中的继承顺序

    rest_framework中APIView、GenericAPIView、5个视图扩展类、9个子类视图、ModelViewSet、ViewSet、ViewSetMixin的继承顺序

    APIView(重写了as_view、局部取消了csrf认证, 继承View)

    image-20200708154809111


    ViewSetMixin(重写了as_view,局部取消了csrf认证,继承object)

    image-20200708154809111


    GenericAPIView(queryset属性、serializer_class属性,继承APIView)

    image-20200708155419698


    5个视图扩展类(均继承object)

    1)ListModelMixin:lsit查询多条

    2)CreateModelMixin:create新增一条

    3)UpdateModelMixin:update修改一条

    4)RetrieveModelMixin:retrieve查询一条

    5)DestroyModelMixin:destroy删除一条

    image-20200708163533064


    9个子类视图(均继承GenericAPIView)

    1)ListAPIView:查所有,继承GenericAPIViewListModelMixin

    image-20200708164056039

    2)CreateAPIView:新增一条,继承GenericAPIViewCreateModelMixin

    image-20200708163644707

    3)RetrieveAPIView:查一条,继承GenericAPIViewRetrieveModelMixin

    image-20200708164534203

    4)UpdateAPIView:修改一条,继承GenericAPIViewUpdateModelMixin

    image-20200708170451129

    5)DestroyAPIView:删一条,继承GenericAPIViewDestroyModelMixin

    image-20200708165111009

    6)ListCreateAPIView:查所有、新增一条,继承GenericAPIViewListModelMixinCreateModelMixin

    image-20200708170602576

    7)RetrieveDestroyAPIView:查一条、删一条,继承GenericAPIViewRetrieveModelMixinDestroyModelMixin

    image-20200708170902442

    8)RetrieveUpdateAPIView:查一条、改一条,继承GenericAPIViewRetrieveModelMixinUpdateModelMixin

    image-20200708170653088

    9)RetrieveUpdateDestroyAPIView:查一条、改一条、删一条,继承GenericAPIViewRetrieveModelMixinUpdateModelMixinDestroyModelMixin

    GenericViewSet(继承GenericAPIView、ViewSetMixin)

    image-20200708171853928

    ModelViewSet(继承GenericViewSet、以及5个视图扩展类)

    image-20200708171759992

  • 相关阅读:
    JQuery实现模糊查询关键字高亮输入框
    jq--实现自定义下拉框
    js 实现颜色值格式转换 rgb和十六进制的转换
    原生JavaScript设置、获取 单选框、复选框 的值
    win10 开启端口,auto.js端口
    AES的加密和解密(Java and javascript)
    去除移动端 alert / confirm 显示的 url
    移动端拖拽
    前台传入base64图片,java后台转为MultipartFile文件
    移动端调试vConsole
  • 原文地址:https://www.cnblogs.com/guanxiying/p/13268390.html
Copyright © 2011-2022 走看看