0
在我看来,我试图循环所有页面,并使用下面的代码为每个页面提取名称。但它似乎没有工作。Django AJAX循环数据
我该如何做到这一点?
view.py
json_dict = json.loads(request.POST['site'])
for item in json_dict['pages']:
item.json_dict['name']
JSON数据
{
"someitem": "xaAX",
"pages": [
{
"id": "1364484811734",
"name": "Page Name",
"type": "basic",
"components": {
"img": "",
"text": ""
}
},
{
"id": "1364484812918",
"name": "Contact",
"type": "contact",
"components": {
"text": "Send us an email using the form below.",
"contact-form": {
"contact-name": "zzz",
"contact-email": "zz"
}
}
},
]
}