开发者

Django template: pass a variable to view {{ dic.{{ a.d }} }}

Django template: pass a variable to view {{ dic.{{ a开发者_高级运维.d }} }} // Access a dictionary

I need to pass a variable to dic, and this variable come from {{ a.d }}

So, what is the best way to do that?

Ok, I need to look up a dictionary.

{{ a.d }} returns a key.

so {{ dic.key }} will work.


{% with a.d as key %}
 ...
  {{ dic.key }}
 ...
{% endwith %}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜