上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
  2019年7月6日
摘要: 解析器分类: 1. JSONPaser > 解析 JSON-serialized data (解析JSON序列化的数据) 2.FormParser >解析form 表单中 urlencoded格式数据(application/x-ww-form-urlencoded) 3.MartiPartPars 阅读全文
posted @ 2019-07-06 21:35 QzkRainPig 阅读(156) 评论(0) 推荐(0) 编辑
  2019年7月5日
摘要: 请求头ContentType application/x www form urlencoded multipart/form data application/json rest_framework 中的几个常用解析器 解析器的使用 局部配置 第一步,先导入模块 第二步,在你所需要配置的视图类中配 阅读全文
posted @ 2019-07-05 20:57 QzkRainPig 阅读(468) 评论(0) 推荐(0) 编辑
摘要: Django rest_framework 之 版本控制 一、何为版本控制: ​ 用于版本的控制 二、内置的版本控制类: 三、局部使用 先导入模块 在视图类中写入配置 在settings.py 中配置 REST_FRAMEWORK 四、全局使用(一般都是全局配置) 五、示例 urls.py seri 阅读全文
posted @ 2019-07-05 19:54 QzkRainPig 阅读(170) 评论(0) 推荐(0) 编辑
  2019年7月4日
摘要: restframework 源码分析以及使用 mixins 中的五种类方法 GenericAPIView类源码 python from rest_framework.generics import GenericAPIView class GenericAPIView(views.APIView): 阅读全文
posted @ 2019-07-04 22:50 QzkRainPig 阅读(736) 评论(0) 推荐(0) 编辑
摘要: 核心源码 python class SimpleRateThrottle(BaseThrottle): cache = default_cache timer = time.time cache_format = 'throttle_%(scope)s_%(ident)s' scope = None 阅读全文
posted @ 2019-07-04 19:36 QzkRainPig 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Django 之 restframework 频率组件的使用以及源码分析 频率组件的使用 第一步,先写一个频率类,继承SimpleRateThrottle 一定要在这个类里面配置一个scop=‘字符串’ 字符串用于settings里面配置频率组件 在该类里面重写 get_cache_key, 返回s 阅读全文
posted @ 2019-07-04 16:44 QzkRainPig 阅读(250) 评论(0) 推荐(0) 编辑
  2019年7月3日
摘要: Django之DRF之认证组件 python from rest_framework.views import APIView APIView 中的 dispatch 中 执行的 self.initial(request, args, kwargs)中的 APIView dispatch self. 阅读全文
posted @ 2019-07-03 23:51 QzkRainPig 阅读(279) 评论(0) 推荐(0) 编辑
摘要: Django之DRF源码分析(二) 数据校验部分 is_valid() 源码 python def is_valid(self, raise_exception=False): assert not hasattr(self, 'restore_object'), ( 'Serializer has 阅读全文
posted @ 2019-07-03 20:08 QzkRainPig 阅读(1053) 评论(0) 推荐(0) 编辑
  2019年7月2日
摘要: rest framework序列化之Serializer models.py view部分: 注意: ​ source 如果是字段,会显示字段,如果是方法,会执行方法,不用加括号(authors=serializers.CharField(source='authors.all')) ​ 如在模型中 阅读全文
posted @ 2019-07-02 22:56 QzkRainPig 阅读(1012) 评论(0) 推荐(0) 编辑
  2019年7月1日
摘要: Django 之 djangorestframework的APIView分析 APIView 类中的as_view() 方法 首先 我们从视图函数入手,在urls.py 中的 URLconfig中添加一条路由 此时,我们的BookView已经不是继承自django.views中View了,而是res 阅读全文
posted @ 2019-07-01 20:56 QzkRainPig 阅读(312) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页