I'm using this package https://pypi.org/project/django-vote/  and i want to 
do something smilar to this guy 
https://github.com/shellfly/django-vote/issues/51 - I need function 
callable in template, which will tell me if user has downvoted or upvoted, 
but exactly downvoted or exactly upvoted. I don't know where should I put 
it's code to make it work. It should take two arguments: user_id and answer.

My view:

def question(request, question_id):
question = get_object_or_404(Question, pk=question_id)
form = AnswerForm()
return render(request, 'questions/question.html', {'question': question, 
'form' : form},)

I'd like to use this function here with upvote, downvote elements.:

{% for answer in question.answers.all %}
<h3>{{answer.author}}</h3>
<p>{{answer.content}}</p>
<p>
<i class="upvote" data-answer-id="{{answer.id}}">&#8593</i>
<span id="score-{{answer.id}}">{{answer.votes.count}}</span>
<i class="downvote" data-answer-id="{{answer.id}}">&#8595</i>
</p>
{% endfor %}

Also I'm not sure which functions can be called in Django templates. Only 
those having no arguments?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/050550b7-65db-4e08-9b22-c367f7b2a71f%40googlegroups.com.

Reply via email to