[Django]-Getting None values for POST request (via the Axios library) sent to Python/Django

7👍

Write your python POST request like this:

def update_template_country(request):
  data = json.loads(request.body)
  id = data["id"]
  country = data["country"]
  '''Any other function you want to perform'''
  return HttpResponse(json.dumps({'message':'The country is changed'},status=200)

Basically the problem is with the format of POST request, Django is not able to parse it properly that’s why when you print the POST request it return an empty dictionary.

Leave a comment