{ "info": { "author": "Mirat Can Bayrak", "author_email": "miratcanbayrak@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "===============\nQhonuskan-Votes\n===============\n\nEasy to use reddit like voting system for django models.\n\nFeatures\n--------\n\n* Does not use GenericForeignKeys (which irritates me when making queries)\n Has vote_buttons_for templatetag, that generates html code for your object\n for vote buttons.\n\n* Has, default_buttons.css which gives a shape your buttons as default, but\n you can override.\n\n* Has, voting_script template tag, it generates javascript code to make\n ajax requests for voting. Automatically finds qhonuskan_votes views.\n\n* voting_script tag also renders overridable show_not_authenticated_error\n function, so you can use your own error windows (jquery-ui etc.) via\n overriding it.\n\n* Default buttons are pure css, there is no images. So it's lite.\n\nWhat's new?\n-----------\nversion 0.2\n'''''''''''\n* Defined ``get_version`` method to get project version in your code.\n* Lettuce tests are added for testing voting system.\n* Changed ``vote`` view name as ``qhonuskan_vote``. Prefix is required for\n minimizing view name conflicts.\n* Moved templates to ``templates/qhonuskan`` directory.\n* Minimum Django version that we supported is 1.3.\n\n\nQuick Implementation Guide\n--------------------------\n\n1. Add qhonuskan_votes to your INSTALLED_APPS.\n\n ::\n\n INSTALLED_APPS = ('...',\n '...',\n 'qhonuskan_votes')\n\n\n2. Add **VotesField**, and add **ObjectsWithScoresManager** to your model.\n\n ::\n\n from django.db import models\n from qhonuskan_votes.models import VotesField\n\n class MyModel(models.Model):\n votes = VotesField()\n\t # Add objects before all other managers to avoid issues mention in http://stackoverflow.com/a/4455374/1462141\n\t objects = models.Manager()\n\n\t #For just a list of objects that are not ordered that can be customized.\n objects_with_scores = ObjectsWithScoresManager()\n\n\t #For a objects ordered by score.\n\t sort_by_score = SortByScoresManager()\n ...\n ...\n\n3. Syncdb.\n4. Extend your urls [#]_.\n ::\n\n import qhonuskan_votes.urls\n from django.conf.urls.defaults import *\n\n urlpatterns = patterns('',\n ...\n ...\n url(r'^votes/', include(qhonuskan_votes.urls)),\n )\n\n5. Create the list in you view. Use\n\n ::\n\n #For a regular list of items without votes from your model use the following:\n item_list_no_score = Items.objects.all()\n\n #For a list with scores that can be customized with use the following:\n item_list_unordered_with_scores = Items.objects_with_scores.all()\n #to customize the order by a field unique to your model. So something like this:\n item_list_unordered_with_scores = Items.objects_with_scores.all().order_by(-date_created)\n\n #To obtain a list of items sorted by vote counts like (1,0,-1) like Reddit:\n item_list_ordered__scores = Items.sort_by_score.all()\n\n\n6. Load qhonuskan_votes templatetags from your template. You will need STATIC_PREFIX too.\n\n ::\n\n {% load qhonuskan_votes static %}\n {% get_static_prefix as STATIC_PREFIX %}\n\n\n7. Load default_buttons.css to give little shape to buttons\n\n ::\n\n \n\n8. After that line, if you wish you can override some properties\n\n ::\n\n \n\n9. Load jquery to your template\n\n ::\n\n \n\n10. After all, you can add voting_script template tag to your head section.\nIt generates necessary javascript code for ajax requests.\n\n ::\n\n {% voting_script %}\n\n11. use vote_buttons_for_object template tag to create buttons.\n\n ::\n\n {% for object in objects %}\n