django模板出现:‘WSGIRequest‘ object has no attribute ‘Get‘错误

request.GET是一个 QueryDict 类型对象,类似于字典,每个键中可以包含多个值,它能够获取所有GET的请求参数

  • 但在获取参数之前,需要先判断所请求的参数是否存在,否则就会出现以下错误:++'WSGIRequest' object has no attribute 'Get'++

修改前:

复制代码
    if request.Get.get('educational'):
        defaultEducation = request.Get.get('educational')

修改后:

复制代码
    if 'educational' in request.GET:
        defaultEducation = request.GET.get('educational')
相关推荐
BK贝壳41 分钟前
bool-hybrid-array 的 GPU_opt 与 cjx:一个没显卡就报错的开关,一个把 800 字压到 96 字节的编码
python
考虑考虑4 小时前
tcpdump指令
运维·后端·自动化运维
BD_Marathon4 小时前
安装Jupyter notebook
ide·python·jupyter
Zlzxzw5 小时前
End-to-End Autonomous Generation of Human Assembly Plans
python
Wellijohn5 小时前
2000 个请求、30% 失败率:我把 Python 批量并发的限流和重试参数算了一遍
后端·python·性能优化
皮皮林5516 小时前
YouTube 是如何保存巨量视频文件的?
后端
学长毕设6 小时前
基于SpringBoot 车辆租赁系统平台-附源码
java·spring boot·后端
码途行者6 小时前
每天10分钟学Go:第22课 自定义错误
开发语言·后端·golang
Csvn7 小时前
Nginx 性能调优与压测:连接账本、找拐点与调优前后对比
后端·nginx
Logintern097 小时前
deep agents 多智能体模式——规划与委派
python·langchain