繁体   English   中英

Django - 无效的块标记..'else',预期为 'empty' 或 'endfor'。 您是否忘记注册或加载此标签?

[英]Django - Invalid block tag..'else', expected 'empty' or 'endfor'. Did you forget to register or load this tag?

我在加载此内容时遇到问题。 我对 python 相当陌生,它正在格式化。 我检查了以前的问题,似乎是语法错误,但我看不到任何格式问题。 代码直接取自 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 %}

非常感谢 Tom Dalton,问题是缺少的 {% endear %}。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM