[Django]-Django POST sub-dictionaries

7đź‘Ť

âś…

HTTP data elements can’t have sub-elements. The data you have posted – as shown in the querydict – has been interpreted as a single element with key “place[name]” and value “Starbucks”. So you can get it with request.POST["place[name]"].

0đź‘Ť

It looks like you are sending a string, in that case try:

request.POST.get('place[name]')

If your are simulating a dropdown list you should send “place=Starbucks”, however if you are trying to send an array you should try to convert you string to an array inside your python script.

In your command you can get ride of “-X POST” as the parameter -d is already an HTTP POST:

curl --help
...
-d/--data <data>   HTTP POST data (H)

curl manual:
http://curl.haxx.se/docs/manual.html

👤Kevin

Leave a comment