Vote is a simple Django app to conduct vote for each model
Install
django-vote
by pip:pip install django-vote
Add
'vote'
to yourINSTALLED_APPS
setting like this:INSTALLED_APPS = ( ... 'vote', )
Run
python manage.py syncdb
to create the vote models.Declare vote field to the model you want to vote:
from vote.managers import VotableManager class ArticleReview(models.Model): ... votes = VotableManager()
Use vote API:
>>> review = ArticleReview.objects.get(pk=1) >>> review.votes.up(user) >>> review.votes.down(user)
Adds a new vote to the object
Removes vote to the object
Check if the user already voted the object
Returns the number of votes for the object
Returns a list of users who voted and their voting date
add extra info to original queryset