错误引用{% for film in form %}
未在以下位置关闭:form-template.html:
{% for field in form %}
{{field.errors}}
<label>{{ field.label_tag }}</label>
{{ field }}
{$ endfor %}
我的comment_form.html:
<form action="" method="post">
{$ csrf_token %}
{% include 'films/form-template.html' %}
<button type="submit">Submit</button>
</form>
urls.py:
app_name = 'films'
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
# path('<int:film_id>/comment', views.add_comment, name='add_comment'),
path('<int:pk>', views.DetailView.as_view(), name='detail'),
path('<int:film_id>/add/$', views.CommentCreate.as_view(), name='add_comment'),
]
答案 0 :(得分:2)
for循环的结束标记中有错误。
{$ endfor %}
应该是
{% endfor %}