Django模板如何使用变量查找字典值
mydict = {"key1":"value1", "key2":"value2"}
{{ mydict.key1 }}
, {{ mydict.key2 }}
{% for item in list %} # where item has an attribute NAME {{ mydict.item.NAME }} # I want to look up mydict[item.NAME]{% endfor %}
mydict.item.NAME
繁星coding