周晓楠

导航

 

2020年9月28日

摘要: 1.1 什么是RESTful 1.REST与技术无关,代表的是一种软件架构风格(REST是 Representational State Transfer的简称。中文翻译为“表征状态转移”) 2.REST从资源的角度类审视整个网络,他将分布在网络中的某个节点的资源通哥URL进行标识 3.所有的数据, 阅读全文
posted @ 2020-09-28 19:31 周晓楠 阅读(170) 评论(0) 推荐(0) 编辑
 
摘要: 1.1 axios 基本用法 安装:npm install axios -S # 也可直接下载axios.min.js文件 1、axios借助Qs对提交数据进行序列化 axios参考博客:https://www.jianshu.com/p/68d81da4e1ad https://www.cnblo 阅读全文
posted @ 2020-09-28 19:12 周晓楠 阅读(165) 评论(0) 推荐(0) 编辑
 
摘要: 自带验证器 1、UniqueValidator 用于验证(唯一)unique=True的字段,常用参数: queryset: required,用于明确验证唯一性集合,必须设置 message:当验证失败时的提示信息 from rest_framework.validators import Uni 阅读全文
posted @ 2020-09-28 17:21 周晓楠 阅读(522) 评论(0) 推荐(0) 编辑
 
摘要: def validate_字段名(self, value),单一字段校验 from rest_framework import serializers from rest_framework import exceptions from .. import models class BidModel 阅读全文
posted @ 2020-09-28 17:15 周晓楠 阅读(445) 评论(0) 推荐(0) 编辑
 
摘要: 1.APIView DRF框架的视图的基类是 APIViewAPIView的基本使用和View类似 Django默认的View请求对象是 HttpRequest,REST framework 的请求对象是 Request。Request对象的数据是自动根据前端发送数据的格式进行解析之后的结果。Htt 阅读全文
posted @ 2020-09-28 17:11 周晓楠 阅读(844) 评论(0) 推荐(0) 编辑
 
摘要: ModelViewSet源码 class ModelViewSet(mixins.CreateModelMixin, mixins.RetrieveModelMixin, mixins.UpdateModelMixin, mixins.DestroyModelMixin, mixins.ListMo 阅读全文
posted @ 2020-09-28 17:05 周晓楠 阅读(290) 评论(0) 推荐(0) 编辑