All Projects → shellfly → Django Vote

shellfly / Django Vote

Licence: other
Simple vote for django

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Vote

Django Dersleri
YouTube Django Dersleri için proje kaynak kodu
Stars: ✭ 135 (-4.26%)
Mutual labels:  django
Djangoweb
基于Django的运维平台
Stars: ✭ 137 (-2.84%)
Mutual labels:  django
Django Mfa
Django-mfa (Multi Factor Authentication) is a simple package to add extra layer of security to your django web application. It gives web app a randomly changing password as an extra protection and supports u2f too
Stars: ✭ 139 (-1.42%)
Mutual labels:  django
Django Prices
Django fields for the prices module
Stars: ✭ 135 (-4.26%)
Mutual labels:  django
Jbt blog
一个基于Django2.0+Python3.6的博客/A simple blog based on python3.6 and Django2.0.
Stars: ✭ 137 (-2.84%)
Mutual labels:  django
Django Scopes
Safely separate multiple tenants in a Django database
Stars: ✭ 138 (-2.13%)
Mutual labels:  django
Django Business Logic
Visual DSL framework for django
Stars: ✭ 134 (-4.96%)
Mutual labels:  django
Djangorestframework Dataclasses
Dataclasses serializer for Django REST framework
Stars: ✭ 138 (-2.13%)
Mutual labels:  django
Cosmos Search
🌱 The next generation unbiased real-time privacy and user focused code search engine for everyone; Join us at https://discourse.opengenus.org/
Stars: ✭ 137 (-2.84%)
Mutual labels:  django
Django Braces
Reusable, generic mixins for Django
Stars: ✭ 1,756 (+1145.39%)
Mutual labels:  django
Django Anon
Anonymize production data so it can be safely used in not-so-safe environments
Stars: ✭ 136 (-3.55%)
Mutual labels:  django
Pinry
The open-source core of Pinry, a tiling image board system for people who want to save, tag, and share images, videos and webpages in an easy to skim through format.
Stars: ✭ 1,819 (+1190.07%)
Mutual labels:  django
Django Echarts
A django app for Echarts integration using pyecharts library as chart builder.
Stars: ✭ 138 (-2.13%)
Mutual labels:  django
Cleanerversion
CleanerVersion adds a versioning/historizing layer to your relational DB which implements a "Slowly Changing Dimensions Type 2" behavior
Stars: ✭ 135 (-4.26%)
Mutual labels:  django
Django Postgres Copy
Quickly import and export delimited data with Django support for PostgreSQL's COPY command
Stars: ✭ 139 (-1.42%)
Mutual labels:  django
Saleor
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React.
Stars: ✭ 14,720 (+10339.72%)
Mutual labels:  django
Freedombox
Easy to manage, privacy oriented home server. Read-only mirror of https://salsa.debian.org/freedombox-team/freedombox
Stars: ✭ 137 (-2.84%)
Mutual labels:  django
Django Intro Zh
Django 官方文档的 intro 部分的中文翻译
Stars: ✭ 141 (+0%)
Mutual labels:  django
Gh Polls
These polls work by pasting individual markdown SVG images into your issue, each wrapped with a link that tracks a vote. A single vote per IP is allowed for a given poll, which are stored in DynamoDB.
Stars: ✭ 1,726 (+1124.11%)
Mutual labels:  vote
Django Starter Template
A project template for Django 2.0 that follows best practices.
Stars: ✭ 138 (-2.13%)
Mutual labels:  django

Django Vote

django-vote is a simple Django app to conduct vote for django model.

This project is inspired by django-taggit

Build Status codecov PyPI version

Quick start

Install django-vote by pip

pip install django-vote

Add 'vote' to your INSTALLED_APPS setting like this

INSTALLED_APPS = (
  ...
  'vote',
)

Add VoteModel to the model you want to vote

from vote.models import VoteModel

class ArticleReview(VoteModel, models.Model):
    ...

Run migrate

manage.py makemigrations
manage.py migrate

Use vote API

review = ArticleReview.objects.get(pk=1)

# Up vote to the object
review.votes.up(user_id)

# Down vote to the object
review.votes.down(user_id)

# Removes a vote from the object
review.votes.delete(user_id)

# Check if the user already voted the object
review.votes.exists(user_id)

# Returns the number of votes for the object
review.votes.count()

# Returns a list of users who voted and their voting date
review.votes.user_ids()


# Returns all instances voted by user
Review.votes.all(user_id)

Use VoteMixin for REST API

class CommentViewSet(ModelViewSet, VoteMixin):
    queryset = Comment.objects.all()
    serializer_class = CommentSerializer
POST /api/comments/{id}/vote/
POST /api/comments/{id}/vote/ {"action":"down"}
DELETE /api/comments/{id}/vote/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].