简体   繁体   中英

Dictionary inside a dictionary in django template

I have dictionary which has:

a = {'card1' :{'name':'abc','amount':'145820'},'card2':{'name':'dba','amount':'258963'}}

Now, I want to print card1.amount in Django template. How do I do it?

The Django template language allows you to do multiple lookups eg {{ abcd }} . In your example, it looks like you want {{ a.card1.amount }} in the template.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM