django-vote
django-vote copied to clipboard
django-vote does not support down voting as README states
I have implemented django-vote in one of my projects and I found an odd behaviour where a user could perform a 'downvote' to the same object over and over, and obj.votes.exists(user_id) would return false because the 'downvote' is not committed to the vote object but nevertheless is counted in num_vote_down.
If 5 users decided to 'downvote' an object, we will have num_vote_down equals 5, but the user_ids would still return an empty queryset and the exists method would return false for each users.
This happens only regarding the down method.
Am I missing something? Thank you for your help!
The down feature was added later, the document doesn't mention there is a new action parameter for both exists and the user_ids function, you can use the second parameter to get your expected result.
Thank you for your response.
I see, so in order to check whether a user has voted regardless of whether it was an upvote or downvote, I need to check both against obj.votes.exists(user_id, action=UP) and obj.votes.exists(user.id, action=DOWN), correct?
If you would like, I could contribute to this project to have docs updates and a method that checks whether a user has a vote regardless of what it is.
That will be great, any contribution is welcome
Alright cool! Thanks for the help.