摘要:
### ajax发送json格式数据 ```python """ 前后端传输数据的时候一定要确保编码格式跟数据真正的格式是一致的 不要骗人家!!! {"username":"jason","age":25} 在request.POST里面肯定找不到 django针对json格式的数据 不会做任何的处 阅读全文
posted @ 2022-04-05 04:23
咖喱给给啊
阅读(103)
评论(0)
推荐(0)
摘要:
# 我们主要研究post请求数据的编码格式 """ get请求数据就是直接放在url后面的 url?username=jason&password=123 """ # 可以朝后端发送post请求的方式 """ 1.form表单 2.ajax请求 """ """ 前后端传输数据的编码格式 urlenc 阅读全文
posted @ 2022-04-05 04:22
咖喱给给啊
阅读(109)
评论(0)
推荐(0)
摘要:
""" 异步提交 局部刷新 例子:github注册 动态获取用户名实时的跟后端确认并实时展示的前端(局部刷新) 朝发送请求的方式 1.浏览器地址栏直接输入url回车 GET请求 2.a标签href属性 GET请求 3.form表单 GET请求/POST请求 4.ajax GET请求/POST请求 A 阅读全文
posted @ 2022-04-05 03:31
咖喱给给啊
阅读(18)
评论(0)
推荐(0)
摘要:
# 全自动:利用orm自动帮我们创建第三张关系表 class Book(models.Model): name = models.CharField(max_length=32) authors = models.ManyToManyField(to='Author') class Author(m 阅读全文
posted @ 2022-04-05 03:30
咖喱给给啊
阅读(19)
评论(0)
推荐(0)
摘要:
# MTV:Django号称是MTV模型 M:models T:templates V:views # MVC:其实django本质也是MVC M:models V:views C:controller # vue框架:MVVM模型 阅读全文
posted @ 2022-04-05 03:29
咖喱给给啊
阅读(14)
评论(0)
推荐(0)
摘要:
class School(models.Model): """ 校区表 如: 北京沙河校区 上海校区 """ title = models.CharField(verbose_name='校区名称', max_length=32) def __str__(self): return self.tit 阅读全文
posted @ 2022-04-05 03:27
咖喱给给啊
阅读(25)
评论(0)
推荐(0)
摘要:
""" 用户表 性别 学历 工作经验 是否结婚 是否生子 客户来源 ... 针对某个可以列举完全的可能性字段,我们应该如何存储 只要某个字段的可能性是可以列举完全的,那么一般情况下都会采用choices参数 """ class User(models.Model): username = model 阅读全文
posted @ 2022-04-05 03:26
咖喱给给啊
阅读(22)
评论(0)
推荐(0)
摘要:
```python from django.shortcuts import render,redirect,HttpResponse from app01 import models # Create your views here. def home(request): return rende 阅读全文
posted @ 2022-04-05 03:23
咖喱给给啊
阅读(74)
评论(0)
推荐(0)
摘要:
```python only与defer select_related与prefetch_related """ orm语句的特点: 惰性查询 如果你仅仅只是书写了orm语句 在后面根本没有用到该语句所查询出来的参数 那么orm会自动识别 直接不执行 """ # only与defer # res = 阅读全文
posted @ 2022-04-05 03:15
咖喱给给啊
阅读(22)
评论(0)
推荐(0)
摘要:
AutoField 主键字段 primary_key=True CharField varchar verbose_name 字段的注释 max_length 长度 IntegerField int BigIntegerField bigint DecimalField max_digits=8 d 阅读全文
posted @ 2022-04-05 02:35
咖喱给给啊
阅读(28)
评论(0)
推荐(0)
浙公网安备 33010602011771号