04-03 七个功能视图子类
七个子类视图 1)CreateAPIView 提供 post 方法 继承自: GenericAPIView、CreateModelMixin 2)ListAPIView 提供 get 方法 继承自:GenericAPIView、ListModelMixin 3)RetrieveAPIView 提供 get 方法 继承自: GenericAPIVie…
04-04 视图集
视图集ViewSet 使用视图集ViewSet,可以将一系列逻辑相关的动作放到一个类中: list() 提供一组数据 retrieve() 提供单个数据 create() 创建数据 update() 保存数据 destory() 删除数据 ViewSet视图集类不再实现get()、post()等方法,而是实现动作 action 如 list() 、…
05-01 认证组件
认证组件 1、authentication """ 系统:session认证 rest_framework.authentication.SessionAuthentication ajax请求通过认证: cookie中要携带 sessionid、csrftoken,请求头中要携带 x-csrftoken 第三方:jw…