我在申请模板时收到错误消息:
无效的块标记:' score_for_object',预期'空' o' endfor'
我的模板如下:
{% score_for_object object as score %}
<h5>Votes <span id="score">{{ score.score }}</span> point{{ score.score|pluralize }}
after <span id="num_votes">{{ score.num_votes }}</span> vote{{ score.num_votes|pluralize }}</h5>
<ul>
<li><a href="#" onclick="vote('{{ object.slug }}', 'up');">I like it!</a></li>
<li><a href="#" onclick="vote('{{ object.slug }}', 'down');">I hate it!</a></li>
<li><a href="#" onclick="vote('{{ object.slug }}', 'clear');">I take it back! Clear my vote.</a></li>
</ul>
{% endscore_for_object object %}
我试过没有{%endscore_for_object对象%}并且我收到了相同的错误消息 我的网址:
tip_dict = {
'model': Promo,
'template_object_name': 'promos',
'slug_field': 'slug',
'allow_xmlhttprequest': 'true',
}
urlpatterns += patterns('',
url(r'^(?P<object_id>\d+)/(?P<direction>up|down|clear)vote/?$', vote_on_object, tip_dict, name="tip-voting"),
)
提前致谢!
答案 0 :(得分:3)