[Answered ]-Cannot get values from request in Django โ€“ Empty QueryDict

1๐Ÿ‘

โœ…

You wrote the data as body of the request in a JSON format. You thus should decode the JSON format to a dictionary with:

import json

data = json.loads(request.body)
print(data['title'])

If you are using a request from the Django REST framework, you work with request.data:

import json

print(request.data['title'])

request.data will look for POST parameters and a JSON body.

Leave a comment