1
我想要訪問Django模板中的多維字典。我能夠查看第一級密鑰,但從第二級密鑰我什麼都看不到。在例詞典是由這樣:如何訪問Django模板上的多維字典
dictionary = {}
dictionary[first_level] = {}
dictionary[first_level][second_level] = {}
...
and so on
從Django的模板,我使用:
{% for flk in dict %}
<!-- Using nested for from the following, no output is shown -->
{% for slk in dict.flk %}
<th>First level key : {{ flk }} Second level key : {{ slk }}</th>
{% endfor %}
<!-- -->
{% endfor %}
有我使用一個模型或者我可以做使用這本字典呢?
由於
{%for slk in flk%}? – andrean
這只是一個python問題,而不是一個django問題。 – eLRuLL