lck.django 0.8.5 documentation
Models holding votes for objects of different types. Usage:
TotalScore.get_value(object) -> int
TotalScore.update(object, voter, value, [reason]) -> int
Bases: django.db.models.base.Model
Holds the integer value of the total score for votes on a specific content_object. The value is updated whenever a Vote object is created, modified or deleted. Don’t alter it directly.
Returns a list of stats computed using the specified cases which are a sequence of filtering arguments for the TotalScore vote_set for the specified model (and optionally: instance).
Returns the current score for the specific object or 0 if no-one voted for it yet. Optionally gets value for a specific voter.
Updates the score on object by voting the specific integer value as user voter. Optionally, a reason can be added to the vote. If the voter already voted for this object, she can cancel her vote by specifying value that is the opposite to the one already given. Other attempts to vote multiple times for a single object will be silently ignored.
Conveniently returns the updated total score for the given object.
Bases: lck.django.common.models.TimeTrackable
A single vote. Total score value is updated upon creation and alteration of Vote instances, don’t update it directly.