摘要: - 前端页面展示搜索框 ``` ``` - 后端视图逻辑代码 ``` # 这里是获取搜索form表单提交的搜索关键字 keyword = request.GET.get('keyword','').strip() # 使用Q对象进行或查询 con = Q() if keyword: con.conn 阅读全文
posted @ 2023-08-11 15:22 等日落 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 需求分析: ![image](https://img2023.cnblogs.com/blog/2947776/202307/2947776-20230708113512187-377232509.png) 处理逻辑步骤: - 在跳转到目标url时,先要获取当前页url所携带的参数 ``` # 当前 阅读全文
posted @ 2023-08-11 15:13 等日落 阅读(195) 评论(0) 推荐(0) 编辑
摘要: ## django开启事务 ``` # 先导入模块 from django.db import transaction # 开启事务 try: with transaction.atomic(): 操作数据库的代码块 (出现异常会回滚) except Exception as e: 出现异常会执行下 阅读全文
posted @ 2023-08-11 15:09 等日落 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 最全最细的订单交易系统复盘 0.项目技术栈 项目采用前后端不分离的模式开发 后端:python的django框架 前端:借用django里面的模板层语法、 数据库:mysql 缓存:redis 1.项目环境搭建 1.1 创建django项目 创建纯python项目虚拟环境 pycharm终端安装dj 阅读全文
posted @ 2023-08-11 15:02 等日落 阅读(45) 评论(0) 推荐(0) 编辑