django常用模板语言


一、变量 

django模板接收到从后端传来的参数,放入模板中对应的变量中

#
django代码 def info(request): .... return render(request,'info.html',{'key1':vul1,'key2':vul2})

#HTML代码
<div>{{ key1 }}</div>
<div>{{ key2 }}</div>

HTML中变量要与django传递的代码key值相同
原文地址:https://www.cnblogs.com/WXGC-yang/p/10357186.html