如何在模板中访问tastypie中相关模型的属性

时间:2012-11-09 03:48:33

标签: python django tastypie

当我得到JSON响应时,我得到这样的价值

"objects": [
    {

        "created": "2012-11-01T10:25:25.019881",

        "district": {
            "created": "2012-10-31T05:48:36.883000",
            "description": "",
            "effective_from": "2012-10-31T05:48:36.882000",
            "effective_to": null,
            "id": 3,
            "modified": "2012-10-31T05:48:36.883000",

            "name": "bfdsfselt",
            "resource_uri": "",
            "slug": "fdfsf"
        },
        "effective_from": "2012-10-31T12:35:59.081232",
    }
]

我有通用功能,可以显示太阳穴中的值

for field in fields
    <td>obj[field] </td>

现在在我的区域中显示整个区域的json。是否有任何方式它只显示名称。我已经在unicode中定义了它,但它没有来到这里。

0 个答案:

没有答案