摘要: 修改QueryDict的几种方式 简介 在正常的请求/响应周期中访问时,request.POST和request.GET上的QueryDict将是不可变的. 要获得可变版本,您需要使用QueryDict.copy()或者._mutable = True 第一种方式 用request.POST调用_m 阅读全文
posted @ 2020-07-26 03:21 我在路上回头看 阅读(2942) 评论(0) 推荐(1) 编辑
摘要: models.py模型类 Book模型类下面写一个获取所有作者的函数 class Book(models.Model): ..... def get_all_author(self): # name_list = [] # for author in self.authors.all(): # na 阅读全文
posted @ 2020-07-26 02:55 我在路上回头看 阅读(192) 评论(0) 推荐(1) 编辑
摘要: views.py代码 def test(request): if request.method == 'GET': return render(request,'test.html') elif request.method == 'POST': # print(request.POST) user 阅读全文
posted @ 2020-07-26 01:35 我在路上回头看 阅读(1646) 评论(0) 推荐(0) 编辑
摘要: Cookie cookie解析 会话 http协议是无状态的,无连接的 导致每次客户端访问服务端需要登录成功之后才能访问的页面,都需要用户再重新登录一遍,用户体验极差。 客户端想了个办法,cookie,小甜点 浏览器第一次请求携带的cookie为{},服务器设置cookie并返回给浏览器,浏览器第二 阅读全文
posted @ 2020-07-26 00:49 我在路上回头看 阅读(122) 评论(0) 推荐(0) 编辑