Django Template: Nested Dictionary "for" tag inside of List "for" tag -
I want to be able to repeat on a dictionary within the loop in the deegago template.
For this sample, consider the following:
items_list = [{key1 ':' value1 ',' key2 ':' value2 '}, {' key1 ':' Value5 ',' key2 ':' value9 '}]
method # 1:
{% of dict items_list%} {% Key for Direct, value%} & lt; Tr & gt; & Lt; Td> {{Key}} & lt; / Td> & Lt; Td> {{Value}} & lt; / Td> & Lt; / TR & gt; {% Endfor%} {% endfor%}
Method # 2:
{% items in dict for%} {% item%} & Lt; Tr & gt; & Lt; Td> {{Node.0}} & lt; / Td> & Lt; Td> {{Node.1}} & lt; / Td> & Lt; / TR & gt; {% Endfor%} {% endfor%}
Question
- Why method # 1 does not work? It makes me feel comfortable.
- Is the way I am fixing it in Method # 2 or will it cause problems later?
. ITEMS PROPERTY should be used in Method 1. Try it:
key for {%, value item in dict%}
dict.items () A list of key values added gives. But just Dict is a dictionary object
Comments
Post a Comment