如:在view中定义的函数
info = {‘xiaofang‘: ‘18‘, ‘xiaoming‘: ‘20‘} context = {"info": info}
要在html中变量出info的信息(注意info.items,千万不能漏了items)
{% for info_name,info_age in info.items %} {{ info_name }} {{ info_age }} {% endfor %}
时间: 2024-12-10 10:37:06
如:在view中定义的函数
info = {‘xiaofang‘: ‘18‘, ‘xiaoming‘: ‘20‘} context = {"info": info}
要在html中变量出info的信息(注意info.items,千万不能漏了items)
{% for info_name,info_age in info.items %} {{ info_name }} {{ info_age }} {% endfor %}