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

  • 相关阅读:
    python学习之模块补充二
    MySQL的表关系
    初识数据库
    MySQL基础
    死锁 递归锁 信号量 Event事件 线程q
    进程池/线程池与协程
    线程
    进程相关知识点
    python 之多进程
    socket 基础
  • 原文地址:https://www.cnblogs.com/guanxiying/p/13268390.html
Copyright © 2011-2022 走看看