例如,如果我在未知长度的上下文中有变量; list=[{'key':'A'},{'key':'B'},{'key':'C'}]
list=[{'key':'A'},{'key':'B'},{'key':'C'}]
我怎样才能获得最后一个对象?{{ list.0.key }}适用于第一个,但{{ list.-1.key }}给出; Could not parse the remainder: '-1.key' from 'list.-1.key'
{{ list.0.key }}
{{ list.-1.key }}
Could not parse the remainder: '-1.key' from 'list.-1.key'
django django-templates
django ×1
django-templates ×1