Reputation: 85
im trying new to django, im using django 1.6. I am trying to use django-voting as explained in the tutorial: http://www.justinlilly.com/python/django_voting.html
i get a error message when i request my template:
Invalid block tag: 'score_for_object', expected 'empty' o 'endfor'
my template looks like:
{% 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 %}
I've tried without {% endscore_for_object object %} and i get the same error message my urls:
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"),
)
Thanks in advance!
Upvotes: 0
Views: 177
Reputation: 694
I think you need to load the template tag with somethinhg like
{% load voting_tags %}
at the beginning of your html file, see: Django doc and django-voting doc
Upvotes: 3