Python Django HTML csrf令牌不工作
我试图在我的post表单中加入一个csrf令牌,但我一直收到一个无法调试的错误Python Django HTML csrf令牌不工作,python,html,django,Python,Html,Django,我试图在我的post表单中加入一个csrf令牌,但我一直收到一个无法调试的错误 {% extends 'base.html' %} {% block title %}Data Services{% endblock %} {% block content %} <h1>{{ deal_name }}</h1> <a href="http://127.0.0.1:8000/pick/">Return to Deals here</a> <p
{% extends 'base.html' %}
{% block title %}Data Services{% endblock %}
{% block content %}
<h1>{{ deal_name }}</h1>
<a href="http://127.0.0.1:8000/pick/">Return to Deals here</a>
<p>Which lender do you need to send an email to? </p>
{% if unpaid %}
<form action="/pick/{{ type_id }}/lenders/" method="post">{% csrf token %}
<select name="email_name">
{% for l in unpaid %}
<option value="{{ l.name }}">{{ l.name }}</option>
{% endfor %}
</select>
<input type="submit" value="Email">
</form>
{% endif %}
<div>
<ul>
{% if lender %}
There are {{ lender|length }} lenders who have paid.
{% for l in lender %}
<li> {{ l.name }} </li>
{% endfor %}
{% else %}
<li> As of now no Lenders have been recorded as paid. </li>
{% endif %}
</ul>
</div>
{% endblock %}
我的错误:
第10行的块标记无效:“csrf”,应为“elif”、“else”或“endif”。您是否忘记注册或加载此标签
好像我错过了什么?我已经多次成功地尝试过类似的操作。您没有正确使用标记。两个单词之间没有空格:
{% csrf_token %}
您可以再次浏览有关CSRF的教程,以确保所有其他必要的部分都已就位:
.标签是{%csrf_token%},而不是{%csrf token%}。我想我工作太辛苦了,因为那太傻了。谢谢接受其中一个答案。其惯例;