django 回顯輸出指定的内容

1.如下:

<input id="name" type="text" name="name" value="{% if my_message.name == "hui2" %} hui2 has testing {% endif %}"class="error" placeholder="请输入您的姓名"/>
其中:
"{% if my_message.name == "hui2" %} hui2 has testing {% endif %}"
 hui2 has testing 為輸出的内容
注意:
1.一定要在雙引號下進行
2.循環判斷格式如if ,for 格式為{%%},并且要以{%endif%}作爲結尾
3.如果是變量 格式為{{}},不要弄混
posted @ 2019-05-23 18:00  yanhuidj  阅读(129)  评论(1编辑  收藏  举报