[Django]-POST object via Form-Data ( in Django)

3👍

You probably should use JSON.stringify on doc as follows

form_data.append("cityName", JSON.stringify(doc));

Afterwards in your django view you need to parse the data

import json
...

city_name = json.loads(request.POST.get('cityName'))

example using class based views

import json
from django.views import View


class MyView(View):
    def post(self, request):
        city_name = json.loads(request.POST.get('cityName'))
        ....

Leave a comment