[英]Django - Invalid block tag..'else', expected 'empty' or 'endfor'. Did you forget to register or load this tag?
I'm having trouble loading this.我在加载此内容时遇到问题。 I'm fairly new to python and it's formatting.
我对 python 相当陌生,它正在格式化。 I've checked previous questions where it seems to be a syntax error but I can't see any formatting issues.
我检查了以前的问题,似乎是语法错误,但我看不到任何格式问题。 The code is taken straight from the Django tutorial https://docs.djangoproject.com/en/2.2/intro/tutorial06/
代码直接取自 Django 教程https://docs.djangoproject.com/en/2.2/intro/tutorial06/
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}">
{% if latest_question_list %}
<ul>
{% for question in latest_question_list %}
<li><a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a></li></ul>
{% else %}
<p>No polls are available.</p>
{% endif %}
Thank you so much Tom Dalton, Issue was the missing {% endear %}.非常感谢 Tom Dalton,问题是缺少的 {% endear %}。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.