In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you what to do with Django error reporting django.utils.datastructures.MultiValueDictKeyError. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Django reported an error
[11/Sep/2018 20:57:07] "POST / applyforprivileges/ HTTP/1.1" 500 12918ERROR:default:Traceback (most recent call last): File "/ data/venv4archer/lib/python3.6/site-packages/django/utils/datastructures.py", line 320, in _ _ getitem__ list_ = super (MultiValueDict, self). _ _ getitem__ (key) KeyError: 'query_auditors'During handling of the above exception Another exception occurred:Traceback (most recent call last): File "/ data/venv4archer/lib/python3.6/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback (request, * callback_args, * * callback_kwargs) File "/ data/venv4archer/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func (* args * * kwargs) File "/ data/archer_product/sql/query.py", line 377, in applyforprivileges query_auditors = request.POST ['query_auditors'] File "/ data/venv4archer/lib/python3.6/site-packages/django/utils/datastructures.py", line 322, in _ getitem__ raise MultiValueDictKeyError (repr (key)) django.utils.datastructures.MultiValueDictKeyError: "' query_auditors'"
The reason for reporting the error:
The query_auditor form data in the variable was not obtained.
Csrf_exemptdef applyforprivileges (request): title = request.POST ['title'] cluster_name = request.POST [' cluster_name'] priv_type = request.POST ['priv_type'] db_name = request.POST [' db_name'] valid_date = request.POST ['valid_date'] limit_num = request.POST [' limit_num'] query_auditors = request.POST ('query_auditor')
Solution:
Correctly push the form data to the view through AJAX
/ / submit request $.ajax ({type: "post", url: "/ applyforprivileges/", dataType: "json", data: {title: title, cluster_name: cluster_name Priv_type: priv_type, db_list: db_list, db_name: db_name, table_list: table_list, valid_date: valid_date, limit_num: limit_num Apply_remark: apply_remark, query_auditor: query_auditor}, what to do if Django reports an error django.utils.datastructures.MultiValueDictKeyError Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 242
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.