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')