Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django-异常值:if标记中的表达式意外结束_Django_Django Views_Django Templates - Fatal编程技术网

Django-异常值:if标记中的表达式意外结束

Django-异常值:if标记中的表达式意外结束,django,django-views,django-templates,Django,Django Views,Django Templates,我想不出可能是什么错误。 我已经检查了文档,看看是否有任何语法变化,但我没有发现任何变化 Unexpected end of expression in if tag. Template error: In template /home/dhruv/django-blog/blog/templates/blog/post_detail.html, error at line 5 Unexpected end of expression in if tag. 1 : {% exten

我想不出可能是什么错误。 我已经检查了文档,看看是否有任何语法变化,但我没有发现任何变化

Unexpected end of expression in if tag.

Template error:
In template /home/dhruv/django-blog/blog/templates/blog/post_detail.html, error at line 5
   Unexpected end of expression in if tag.
   1 : {% extends 'blog/base.html' %}
   2 : 
   3 : {% block content %}
   4 :     <div class="post">
   5 :          {% if post.published_date %} 
   6 :             <div class="date">
   7 :                 {{ post.published_date }}
   8 :             </div>
   9 :         {% elif %}
   10 :             <a class="btn btn-default" href="{% url 'post_publish' pk=post.pk %}">
   11 :                 Publish!
   12 :             </a>
   13 :         {% endif %}
   14 : 
   15 :         {% if user.is_authenticated %}
替换:

{% elif %}

************博士

if/else可通过以下方式使用:

{% if condition %}
{% endif %}

替换:

{% elif %}

************博士

if/else可通过以下方式使用:

{% if condition %}
{% endif %}

{% if condition1 %}
{% elif condition2 %} 
{% else %}
{% endif %}
{% if condition %}
{% else %}
{% endif %}