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')
相关推荐
YJlio6 小时前
1.7 通过 Sysinternals Live 在线运行工具:不下载也能用的“云端工具箱”
c语言·网络·python·数码相机·ios·django·iphone
l1t6 小时前
在wsl的python 3.14.3容器中使用databend包
开发语言·数据库·python·databend
青云计划6 小时前
知光项目知文发布模块
java·后端·spring·mybatis
Victor3566 小时前
MongoDB(9)什么是MongoDB的副本集(Replica Set)?
后端
Victor3567 小时前
MongoDB(8)什么是聚合(Aggregation)?
后端
山塘小鱼儿7 小时前
本地Ollama+Agent+LangGraph+LangSmith运行
python·langchain·ollama·langgraph·langsimth
码说AI7 小时前
python快速绘制走势图对比曲线
开发语言·python
wait_luky8 小时前
python作业3
开发语言·python
yeyeye1118 小时前
Spring Cloud Data Flow 简介
后端·spring·spring cloud