Extracting items out of a QueryDict

后端 未结 8 1186
清酒与你
清酒与你 2020-12-29 07:04

I have a querydict that looks like the following:


How would I extract

相关标签:
8条回答
  • 2020-12-29 07:38

    I just experienced the same problem. It happened when I was trying to have my request data be held in request.POST instead of request.body. I was using Django with a trusted backend route already configured to work with request.POST

    In order to send the data within request.POST with the fetch API I had to use 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' which turned my JSON stringifed data into a format like above.

    In learning how to serialize data from Daniel's answer I came across $.param(data), a jquery function which should format it correctly for you.

    0 讨论(0)
  • 2020-12-29 07:48

    You can use - request.data.get("content") This will give you the data directly if in front end (jQuery,Angular) you have NOT used JSON.stringify(data).

    0 讨论(0)
提交回复
热议问题