#35446: GET and POST methods not working
-------------------------------------------+------------------------
Reporter: laetitia6038 | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Good day,
Please assist me. I am busy with a Django project. I am working on Windows
10 with WSL Ubuntu installed together with VSCode. I keep on getting
errors when it comes to the GET and POST methods. I can't seem to find the
bug. Please see below a snippet of the error I get. Will provide snippets
of the actual code if needed.
Environment:
Request Method: POST
Request URL:
http://127.0.0.1:8000/new/
Django Version: 5.0.4
Python Version: 3.10.12
Installed Applications:
['encyclopedia',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/home/laetitia/.local/lib/python3.10/site-
packages/django/utils/datastructures.py", line 84, in __getitem__
list_ = super().__getitem__(key)
During handling of the above exception ('title'), another exception
occurred:
File "/home/laetitia/.local/lib/python3.10/site-
packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/laetitia/.local/lib/python3.10/site-
packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "/home/laetitia/cs50w/wiki/encyclopedia/views.py", line 56, in
new_page
title = request.POST['title']
File "/home/laetitia/.local/lib/python3.10/site-
packages/django/utils/datastructures.py", line 86, in __getitem__
raise MultiValueDictKeyError(key)
Exception Type: MultiValueDictKeyError at /new/
Exception Value: 'title'
Kind regards,
Laetitia
--
Ticket URL: <
https://code.djangoproject.com/ticket/35446>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.