A MultiValueDictKeyError
comes when you try to access something from request.POST
which doesn’t exist. It’s basically the same the python KeyError
. Use request.POST.get('key', 'default_if_key_doesn't exist')
def create(request):
if request.POST:
body = request.POST.get('note', '')
title = request.POST('title', '')
print(f'title = { title }\nbody = { body }'
CLICK HERE to find out more related problems solutions.