I want to reuse any existing voting app in Django.
I tried using Django Voting app – http://code.google.com/p/django-voting/wiki/RedditStyleVoting. This app has following code in models.py
from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_list
from devdocs.apps.kb.models import Link
from voting.views import vote_on_object
But I don’t see any ‘devdocs.apps.kb.models’ in the app.
What should I do ? Should I create my own Link class in the models.py ?
You should replace “Link” with a model you’ve created that represents what users are voting on.
Example from the sample project’s wiki:
The above url config is essentially creating the url end point for you to like, dislike, or remove your vote for an abstract object, which in the example is a “Link”.
You could imagine if you were building a Reddit-like website, users would be posting links. Possible fields on this Link model would be a foreign key to User, a title, and a link.
If this application was similar to StackOverflow, you could potentially make a “Question” and “Answer” model that could then be voted on.
You will also have to create the templates to show your list of Links and when a user likes/dislikes/clears their vote. Likewise this is also detailed in the wiki of the google code project: Reddit Style Voting