摘要: 前言 一、什么是drf # class Student(): # name='pdun' # # def __init__(self,age): # self.age=age # # s1=Student(1) # print(s1.name) # print(s1.age) # print(s1. 阅读全文
posted @ 2019-05-15 22:54 pdun 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 一、CBV与FBV 二、CBV的用法及源码分析 1、用法 #视图层 # 1 先导入View(继承它) from django.views import View # 写一个类继承它, class Test(View): #request必须传,后面的可传可不传(有可能有名,无名分组) def get 阅读全文
posted @ 2019-05-15 21:45 pdun 阅读(532) 评论(0) 推荐(0) 编辑
摘要: RESTful规范 10条规范 总结 django下resful接口规范的编写 class Books(View): # 获取所有图书 def get(self, request): print(type(request)) response = {'status': 100, 'data': No 阅读全文
posted @ 2019-05-15 19:09 pdun 阅读(171) 评论(0) 推荐(0) 编辑