摘要: 解析器 1.json解析器 发一个json格式的post请求。后台打印: request_data > {'title': '北京折叠'} request.POST > <QueryDict: {}> 2.urlencode解析器 request_data > <QueryDict: {'title 阅读全文
posted @ 2018-10-07 14:17 G先生 阅读(280) 评论(0) 推荐(0) 编辑
摘要: throttle(访问频率)组件 1.局部视图throttle from rest_framework.throttling import BaseThrottle VISIT_RECORD={} class VisitThrottle(BaseThrottle): def __init__(sel 阅读全文
posted @ 2018-10-07 13:38 G先生 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 权限组件 写在开头: 首先要在models表中添加一个用户类型的字段: class User(models.Model): name=models.CharField(max_length=32) pwd=models.CharField(max_length=32) type_choice=((1 阅读全文
posted @ 2018-10-07 12:13 G先生 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 1. CBV: pass 2 .APIView class BookView(APIView):pass url(r'^books/$', views.BookView.as_view(),name="books"), url(r'^books/$', View类下的view,name="books 阅读全文
posted @ 2018-10-07 11:21 G先生 阅读(234) 评论(0) 推荐(0) 编辑

:guocheng