zoukankan      html  css  js  c++  java
  • Django项目总结:REST Framework APIView源码分析

    APIView源码分析

    • 子类
      • generics包中
      • GenericAPIView
        • 增加的模型的获取操作
        • get_queryset
        • get_object
          • lookup_field 默认pk
        • get_serializer
        • get_serializer_class
        • get_serializer_context
        • filter_queryset
        • paginator
        • paginate_queryset
        • get_paginated_response
      • CreateAPIView
        • 创建的类视图
        • 继承自GenericAPIView
        • 继承自CreateModelMixin
        • 实现了post进行创建
      • ListAPIView
        • 列表的类视图
        • 继承自GenericAPIView
        • 继承自ListModelMixin
        • 实现了get
      • RetrieveAPIView
        • 查询单个数据的类视图
        • 继承自GenericAPIView
        • 继承自RetrieveModelMixin
        • 实现了get 
      • DestroyAPIView
        • 销毁数据的类视图,删除数据的类视图
        • 继承自GenericAPIView
        • 继承自DestroyModelMixin
        • 实现了delete
      • UpdateAPIView
        • 更新数据的类视图
        • 继承自GenericAPIView
        • 继承自UpdateModelMixin
        • 实现了 put,patch
      • ListCreateAPIView
        • 获取列表数据,创建数据的类视图
        • 继承自GenericAPIView
        • 继承自ListModelMixin
        • 继承自CreateModelMixin
        • 实现了 get,post
      • RetrieveUpdateAPIView
        • 获取单个数据,更新单个数据的类视图
        • 继承自GenericAPIView
        • 继承自RetrieveModelMixin
        • 继承自UpdateModelMixin
        • 实现了 get, put, patch
      • RetrieveDestroyAPIView
        • 获取单个数据,删除单个数据
        • 继承自GenericAPIView
        • 继承自RetrieveModelMixin
        • 继承自DestroyModelMixin
        • 实现了 get, delete
      • RetrieveUpdateDestroyAPIView
        • 获取单个数据,更新单个数据,删除单个数据的类视图
        • 继承自GenericAPIView
        • 继承自RetrieveModelMixin
        • 继承自UpdateModelMixin
        • 继承自DestroyModelMixin
        • 实现了 get, put, patch, delete
    • mixins
      • CreateModelMixin
        • create
        • perform_create
        • get_success_headers
      • ListModelMixin
        • list
          • 查询结果集,添加分页,帮你序列化
      • RetrieveModelMixin
        • retrieve
          • 获取单个对象并进行序列化
      • DestroyModelMixin
        • destroy
          • 获取单个对象
          • 调用执行删除
          • 返回Respon 状态码204
        • perform_destroy
          • 默认是模型的delete
          • 如果说数据的逻辑删除
            • 重写进行保存
      • UpdateModelMixin
        • update
          • 获取对象,合法验证
          • 执行更新
        • perform_update
        • partial_update
          • 差量更新,对应的就是patch
    • viewsets
      • ViewSetMixin
        • 重写as_view
      • GenericViewSet
        • 继承自GenericAPIView
        • 继承自ViewSetMixin
      • ViewSet
        • 继承自APIView
        • 继承自ViewSetMixin
        • 默认什么都不支持,需要自己手动实现
      • ReadOnlyModelViewSet
        • 只读的模型的视图集合
        • 继承自RetrieveModelMixin
        • 继承自ListModelMixin
        • 继承自GenericViewSet
      • ModelViewSet
        • 直接封装对象的所有操作
        • 继承自GenericViewSet
        • 继承自CreateModelMixin
        • 继承自RetrieveModelMixin
        • 继承自UpdateModelMixin
        • 继承自DestroyModelMixin
        • 继承自ListModelMixin

     

  • 相关阅读:
    用友U8 | 【存货管理】存货模块中采购入库单生成凭证的关联单据
    用友U8 | 【应收款管理】手工核销时提示:某某客户被其他用户锁定
    SQL Profiler 跟踪器工具使用说明
    转载--form表单的默认提交行为
    转载--c# chart控件基本使用方法(柱状图和饼图)
    转载--C#使用chart绘制实时折线图,波形图
    控件的InvokeRequired方法
    转载--浅析前端安全之 XSS
    转载--mysql语句如何插入含单引号或反斜杠的值详解
    转载--C#实现WinForm下DataGridView控件的拷贝和粘贴
  • 原文地址:https://www.cnblogs.com/dc2019/p/13472748.html
Copyright © 2011-2022 走看看