DRF Votes
=============================
.. image:: https://badge.fury.io/py/votes.png
:target: https://badge.fury.io/py/votes
DRF Vote is a simple Django Rest Framework app to add ability to like/dislike a model.
Blog
-------------
You can read more about it on my blog_
.. _blog: https://medium.com/tixdo-labs/vote-your-model-with-no-pain-9d7670b65bfd#.5q8jkl7xt.
Quickstart
----------
Note
----------
User must be logged-in to user user-specific apis.
1. Install votes::
pip install votes
2. Add ``'votes'`` to your ``INSTALLED_APPS`` setting like this::
INSTALLED_APPS = (
...
'votes',
)
3. Run ``python manage.py syncdb`` to create the vote models.
4. Declare vote field to the model you want to vote::
from votes.managers import VotableManager
class ArticleReview(models.Model):
...
votes = VotableManager()
5. Include votes url to your urls.py file::
from django.conf.urls import include
from django.conf.urls import url
from votes import urls
urlpatterns += [
url(r'^', include(urls)),
]
=====
DRF Vote
=====
This is extended version of repo django-vote_
.. _django-vote: https://github.com/Beeblio/django-vote
DRF Vote is a simple Django Rest Framework app to add ability to like/dislike a model.
You can read more about it on my blog post_
.. _post: https://medium.com/@3117Jain/vote-your-model-with-no-pain-9d7670b65bfd#.3zttxekr2
=====
How is it different ?
=====
- Modified to work with django rest framework.
- A new feature of disliking an object is added in this version.
APIs
-----------
/votes/up/
==========
Adds a new like or dislike vote to the object
* param: model, id, vote i.e. model=movies&id=359&vote=true
* vote=option[true for up-vote, false for down-vote, None for no-vote]
This api is used for both liking and disliking the object.
Send
vote=true for like
vote=false for dislike
/votes/down/
==========
Removes vote to the object
* param: model, id i.e. model=movies&id=359
/votes/exists/
============
Check if the user already voted the object
* param: model, id i.e. model=movies&id=359
/votes/all/
=========
return all instances voted by user
* param: model, id i.e. model=movies&id=359
/votes/count/
=======
Returns the number of votes for the object
* param: model, id i.e. model=movies&id=359
/votes/users/
=======
Returns a list of users who voted and their voting date
* param: model, id i.e. model=movies&id=359
/votes/likes/
=======
Returns the number of likes and dislikes for the object.
* param: model, id i.e. model=movies&id=359
Running Tests
--------------
Does the code actually work?
::
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements-test.txt
(myenv) $ python runtests.py
Credits
---------
Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-pypackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
History
-------
0.1.0 (2016-02-01)
++++++++++++++++++
* First release on PyPI.
Metadata
Release files for votes 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| votes-1.0.1.tar.gz | 12.5 kB | Without provenance | Details for votes-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| votes-1.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for votes-1.0.1-py2.py3-none-any.whl |
Total release size: 26.7 kB
Release files / votes-1.0.1.tar.gz
| Download URL | votes-1.0.1.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09add1ab8a68556db04696da698ef6928d99bc49aa6be1f6a79bf56d07f879bc
|
|
BLAKE2b-256 checksum How to use checksums |
4a29ff5077931b2b25b28bd31375f33e0cbaca0c872494ae647a69eebbf32b51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / votes-1.0.1-py2.py3-none-any.whl
| Download URL | votes-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
de3c079d7cb8d65c36f2d98c1dd56900899e7ef20e696f72e44493dd766091eb
|
|
BLAKE2b-256 checksum How to use checksums |
11b210e363478657662f89f1f12077ee1c38a02e393f47f5aa3864f790d8878d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for votes 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.