我在views.py中有这个值
values = {"Name":"Mark","Contact":"799865","Message":"Something Here", .... ,"ValueN":"TextN.."}
variables = RequestContext(request, {"values":values)
t = loader.get_template('do.html')
现在在我的do.html中我做了这个..
{%为键,值为%} {{key}} = {{value}} {%endfor%}
但是我在do.html的显示中得到了这个:
v = p v = p v = p T = i v = p v = p v = p v = p v = p v = p v = p v = p v = p v = p v = p v = p v = p .... v = p v = p v = p
我现在的问题是,如何在do.html中使用forloop进行显示,以便它看起来像这样
Name = Mark
Contact = 799865
....
to the end of the loop
我正在做的是,我正在尝试将我的代码转换为php到python django模板
foreach($_POST as $key => $value) {
if (strlen($value) > 0) {
<input type="text" name="<?=$key?>" value="<?=$value?>"/><br>
}
}
在django模板中是否可以使用特定的密钥来加载它{{ choices.items.key }}
?