2👍
You should replace “Link” with a model you’ve created that represents what users are voting on.
Example from the sample project’s wiki:
urlpatterns = patterns('',
# Generic view to list Link objects
(r'^links/?$', object_list, dict(queryset=Link.objects.all(),
template_object_name='link', template_name='kb/link_list.html',
paginate_by=15, allow_empty=True)),
# Generic view to vote on Link objects
(r'^links/(?P<object_id>\d+)/(?P<direction>up|down|clear)vote/?$',
vote_on_object, dict(model=Link, template_object_name='link',
template_name='kb/link_confirm_vote.html',
allow_xmlhttprequest=True)),
)
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