[英]Invalid block tag on line 10: 'endblock', expected 'empty' or 'endfor'. Did you forget to register or load this tag? django (python)
I want registration and log in form in same page and in same html file.我想在同一页面和同一 html 文件中注册和登录表单。 when i render form1 i have problem.
当我渲染 form1 时,我遇到了问题。 i search in google but can't fix.
我在谷歌搜索但无法修复。 can i render two form same html?
我可以渲染两个相同的 html 吗?
this is code --->这是代码--->
{% extends 'base.html' %}
<link rel="stylesheet" type="text/css" href="/static/css/style.css?{% now "U" %}" />
{% block content %}
<form action = '' method="post" novalidate="novalidate" id="reg" >
{% csrf_token %}
<div class="continer">
{% for field in form %}
{{ field.label_tag }}
{{ field }}
{{ field.errors }}
{% endfor %}
<button type="submit" name="register" id="btn" >registraton</button>
<button type="button" name="log" id="lgn">login</button>
</div>
</form>
<form action="" method="post" novalidate="novalidate" id="log">
{% csrf_token %}
<div class="continer2">
{% for field in form1 %}
{{ field }}
</div>
</form>
{% endblock %}
You're missing an endfor
for the last for
loop:你错过了最后一个
for
循环的endfor
:
{% for field in form1 %}
{{ field }}
{% endfor %}
The error message indicated that you might be missing an endwith or endfor which is a hint to look for a with
or for
that hasn't been closed.错误消息表明您可能缺少 endwith 或 endfor 提示寻找未关闭的
with
或for
的提示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.