【发布时间】:2014-03-27 14:26:52
【问题描述】:
我有一本可以包含以下值的字典
images={'25/02/2014': {u'Observation': [<Image: Image object>]}}
那是
{
date:{title1:[obj1, obj2, obj3], title2:[obj1, obj2, obj3]},
date2:{title1:[obj1, obj2, obj3]},
}
我想单独访问这些值,并最终访问每个标题的对象列表。我的代码是
{%for date in images%}
{%for title in images.date%} #equivalent to for title in images[date]:
{{date}} - {{title}}
{% for obj in images.date.title%} #equivalent to for obj in images[date][title]: but not sure
{{obj}}
{%endfor%}
{%endfor%}
{%endfor%}
但它不会工作。它适用于 python 的字典,但不适用于 django 模板。如何访问字典?
【问题讨论】:
-
goo.gl/Evves1 在这里找到...请关闭..对不起!!!
标签: python django dictionary django-templates