micrypt / django-valuate

Once upon a time this was http://code.google.com/p/django-valuate... but now? Fork-fork baby!!!
http://code.google.com/p/django-valuate
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Note: Unmaintained software. Approach with caution.

Valuate

A portable application to easily associate a user valuation (rating, like etc) to any object, just on the basis of template tags. No configuration of existing models and views required.

Installation

Usage

Create a valuation type from the admin site.
Let us say: Rating

or

LikeDislike

Available settings:

DEFAULT_VALUATION_TYPE_ID: The ID of default valuation type to be used in the project Load the template tags: {% load valuation %}

Available tags:

{% render_valuate form of object for valuation_type %}

Renders the valuation form for the provided object.
Override template: 'valuate/form.html' for modifying the look.

{% render_valuate form of object for valuation_type %}

Renders the status according to the score of various choices.
Override template: 'valuate/status.html' for modifying the look.

{% get_valuate ajax_fields of object for valuation_type as variable %}

Get the fields as dictionary required for an ajax post request in the context or directly. Variables available: For post request: 'content_type','object_pk', 'choice' (to be selected by user, can have an initial value if user has already submitted once) 'choices': dictionary of choices for user to provide the 'value' data. 'target': target for the request. 'vtype'": the valuation type. On a successful request, true will be returned. If you are not using a popular javascript liberary, pass on a POST variable with name ajax and a true value.

{% get_valuate form of object for valuation_type as variable %}

Gets the valuation form in context or directly. User form_name.target to access the target for the post request.

{% get_valuate score of object for valuation_type as variable %}

The average score of the object using the corresponding values of chioces.

{% get_valuate choice_count of object for_chioce choice_name for valuation_type as variable %}

Returns the score count for a particular choice of an object. Choice should be provided with quotes (as string).

The for valuation_type and as variable are optional arguments

And that's it!