DjangoのTemplate内で辞書型をfor…inで回す

DjangoのTemplateでfor
文を使用するとき、リスト型なら普通にfor...in
で済みますが
views.py
list = [1,2,3,4]
template
{% for value in list %}
{{ value }}
{% endif %}
辞書型の時に少し詰まったので、備忘録として残しておきます。
辞書型をfor…inでぶん回す
辞書型でfor...in
を使う場合、items
を活用する様です。
views.py
dict = { 'A':'aplha', 'B','bravo', 'C':'charley', }
template
{% for key, value in dict.items %}
{{ key }} is {{ value }}.
{% endfor %}
出力結果
A is aplha.
B is bravo.
C is charley.
これで、Djangoで辞書型をぶん回せます!