Skip to main content

A simple Django app to conduct vote.

Project description

=====
Vote
=====

Vote is a simple Django app to conduct vote for each model


Quick start
-----------

1. Install ``django-vote`` by pip::

pip install django-vote

2. Add ``'vote'`` to your ``INSTALLED_APPS`` setting like this::

INSTALLED_APPS = (
...
'vote',
)

3. Run ``python manage.py syncdb`` to create the vote models.


4. Declare vote field to the model you want to vote::

from vote.managers import VotableManager

class ArticleReview(models.Model):
...
votes = VotableManager()

5. Use vote API::

>>> review = ArticleReview.objects.get(pk=1)
>>> review.votes.up(user)
>>> review.votes.down(user)

API
-----------

up(user)
==========
Adds a new vote to the object

down(user)
==========
Removes vote to the object

exists(user)
============
Check if the user already voted the object

all(user)
=========
return all instances voted by user

count()
=======
Returns the number of votes for the object

users()
=======
Returns a list of users who voted and their voting date

filter()
=======
add extra info to original queryset

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-vote-1.1.0.tar.gz (11.3 kB view details)

Uploaded Source

File details

Details for the file django-vote-1.1.0.tar.gz.

File metadata

  • Download URL: django-vote-1.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-vote-1.1.0.tar.gz
Algorithm Hash digest
SHA256 291d730e747d423049a122e7064a2910935ae7288279cd8ee600f1d99be5d4a2
MD5 efac541957ad73860eeaed87149405bc
BLAKE2b-256 12746165ea1aadcf98deb832604ee850f18a8f83b6684eee9592c4e97e978c23

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page