开发者

Django tags error. Invalid block tag: 'endfor'

What is the problem? It says me that Invalid block tag: 'endfor'.

{%else%}

<ol id="sortable" name="plst{{first_list.pk}}">
{% for item in playlist %}
<li id="item{{item.pk}}" media="{{item.media.pk}}" class="holderPlace"  title="{{item.media.name}}"><span> {{item.media.name|custom_slice:30}} </span>

             {%ifequal item.media.watch_status 0 %}
                <img src="{{MEDIA_URL}}images/content_started_watch_12x12.gif" title="ddd" alt="" height="12" width="12" style="position:relative;top:2px;"/>
            {%else%}
                {%ifequal item.media.watch_status 1 %}
                <img src="{{MEDIA_URL}}images/content_watched_12x12.gif" title="Вы уже смотрели эту передачу" alt="" height="12" width="12" style="position:relative;top:2px;"/>
            {%endifequal%}


<div class="buttons">  <a href="javascript:void(0);" class="myButtonPlay" title="Начать просмотр"><img class="button_play" src="{{MEDIA_URL}}images/playlist/btn_play.gif" width="80" height="28" /></a><span>{{item.media.duration}} мин.</span> <a href="javascript:void(0);" class="deleteButton" title="Удалить из плейлиста"><img src="{{MEDIA_URL}}images/playlist/btn_delete.gif" width="29" height="22" /></a&开发者_运维问答gt; <a href="javascript:void(0);" class="myButtonDown" title="Переместить вниз"><img src="{{MEDIA_URL}}images/playlist/btn_down.gif" width="29" height="22" /></a> <a href="javascript:void(0);" class="myButtonUp" title="Переместить вверх"><img src="{{MEDIA_URL}}images/playlist/btn_up.gif" width="29" height="22" /></a></div>
</li>
{% endfor %}
</ol>
{%endif%}


Check those ifequal tags.

{%ifequal item.media.watch_status 0 %} 
    <img src="{{MEDIA_URL}}images/content_started_watch_12x12.gif" title="ddd" alt="" height="12" width="12" style="position:relative;top:2px;"/> 
{%else%} 
    {%ifequal item.media.watch_status 1 %} 
        <img src="{{MEDIA_URL}}images/content_watched_12x12.gif" title="Вы уже смотрели эту передачу" alt="" height="12" width="12" style="position:relative;top:2px;"/> 
    {%endifequal%}
{%endifequal%}

I think that's what you're trying to do, but not sure.

Explanation: When Django parses the for tag, it just looks for the tag called endfor -- it's actually not a real tag (if that makes any sense). Once the ifequal tag is encountered, it takes over parsing until it encouters its endifequal (which really isn't a real tag either). Since in this case the outer ifequal never found a matching endifequal, once it encountered that endfor it doesn't know what to do with that since it's not a real tag, hence the seemingly odd message for what happened.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜