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')
相关推荐
Victor35636 分钟前
Redis(158)Redis的主从同步问题如何解决?
后端
Victor35636 分钟前
Redis(159)Redis的集群问题如何解决?
后端
少废话h3 小时前
解决Flink中ApacheCommonsCLI版本冲突
开发语言·python·pycharm
serve the people3 小时前
TensorFlow 图执行(tf.function)的 “非严格执行(Non-strict Execution)” 特性
人工智能·python·tensorflow
天命码喽c3 小时前
GraphRAG-2.7.0整合Milvus-2.5.1
开发语言·python·milvus·graphrag
后端小张3 小时前
【JAVA进阶】Spring Boot 核心知识点之自动配置:原理与实战
java·开发语言·spring boot·后端·spring·spring cloud·自动配置
吴佳浩5 小时前
LangChain 深入
人工智能·python·langchain
网安-轩逸8 小时前
回归测试原则:确保软件质量的基石
自动化测试·软件测试·python
v***59838 小时前
Django视图与URLs路由详解
数据库·django·sqlite
X***C8628 小时前
SpringBoot:几种常用的接口日期格式化方法
java·spring boot·后端