Easy plugging of user evaluation system to any django object.
Project description
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
============
- Use django-dev/django 1.3 beta versions
- Run `python setup.py install`
- Include 'valuate' in your installed apps settings.
- Add `(r'^valuate/', include('valuate.urls'))` to your main urls.py.
- Ensure you have request context preprocessor added in the list of preprocessors
or pass request varible context to views.
Usage
=====
**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_valuation_form object 'for_valuation_type' %}
------------------------------------------------------
Renders the valuation form for the provided object.
Override template: 'valuate/form.html' for modifying the look.
{% render_valuation_status object 'for_valuation_type' %}
---------------------------------------------------------
Renders the status according to the score of various choices.
Override template: 'valuate/status.html' for modifying the look.
{% get_valuation_ajax_fields object 'as_name' 'for_valuation_type' %}
---------------------------------------------------------------------
Adds the fields as dictionary required for an ajax post request to
the context with variable name `as_var` provided as a string.
Variables available:
For post request: 'content_type','object_pk', 'value' (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.
On a successfull request, true will be retuned.
If you are not using a popular javascript liberary, pass on a POST
variable with name `ajax` and a `true` value.
{% get_valuation_form object 'as_name' 'for_valuation_type' %}
--------------------------------------------------------------
Adds the valuation form to the context with variable name as_var
provided as a string.
User `form_name.target` to access the target for the post request.
{% get_valuation_score object 'for_valuation_type' %}
-----------------------------------------------------
Returns the average score of the object using the corresponding values
of chioces.
{% get_choice_count object 'choice' 'for_valuation_type' %}
-----------------------------------------------------------
Returns the score count for a perticular choice of an object. Choice
should be provided with quotes (as string).
Example
=======
Create a valuation type from admin site.
Let us say:
**Rating**
- Excellent 5
- Good 4
- Average 3
- Bad 2
- Poor 1
or
**LikeDislike**
- Like 1
- Dislike 0
If you have an object `post` to be associated a valuation (Let us say Rating)
In the template:
- Render the form: `{% render_valuation_form post 'Rating' %}`
- Get Score: `{% get_valuation_score post 'Rating' %}`
And Thats it!
=======
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
============
- Use django-dev/django 1.3 beta versions
- Run `python setup.py install`
- Include 'valuate' in your installed apps settings.
- Add `(r'^valuate/', include('valuate.urls'))` to your main urls.py.
- Ensure you have request context preprocessor added in the list of preprocessors
or pass request varible context to views.
Usage
=====
**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_valuation_form object 'for_valuation_type' %}
------------------------------------------------------
Renders the valuation form for the provided object.
Override template: 'valuate/form.html' for modifying the look.
{% render_valuation_status object 'for_valuation_type' %}
---------------------------------------------------------
Renders the status according to the score of various choices.
Override template: 'valuate/status.html' for modifying the look.
{% get_valuation_ajax_fields object 'as_name' 'for_valuation_type' %}
---------------------------------------------------------------------
Adds the fields as dictionary required for an ajax post request to
the context with variable name `as_var` provided as a string.
Variables available:
For post request: 'content_type','object_pk', 'value' (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.
On a successfull request, true will be retuned.
If you are not using a popular javascript liberary, pass on a POST
variable with name `ajax` and a `true` value.
{% get_valuation_form object 'as_name' 'for_valuation_type' %}
--------------------------------------------------------------
Adds the valuation form to the context with variable name as_var
provided as a string.
User `form_name.target` to access the target for the post request.
{% get_valuation_score object 'for_valuation_type' %}
-----------------------------------------------------
Returns the average score of the object using the corresponding values
of chioces.
{% get_choice_count object 'choice' 'for_valuation_type' %}
-----------------------------------------------------------
Returns the score count for a perticular choice of an object. Choice
should be provided with quotes (as string).
Example
=======
Create a valuation type from admin site.
Let us say:
**Rating**
- Excellent 5
- Good 4
- Average 3
- Bad 2
- Poor 1
or
**LikeDislike**
- Like 1
- Dislike 0
If you have an object `post` to be associated a valuation (Let us say Rating)
In the template:
- Render the form: `{% render_valuation_form post 'Rating' %}`
- Get Score: `{% get_valuation_score post 'Rating' %}`
And Thats it!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-valuate-1.0-beta-1.tar.gz
(12.5 kB
view hashes)
Close
Hashes for django-valuate-1.0-beta-1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a585cf929d9193af0f7cf54891f877595732d286dac02453b1c779b164c9ec1e |
|
MD5 | fcd839172f0aa7902218753e96bb9668 |
|
BLAKE2b-256 | f5a82589adecfb797e3a01c50d887e5284f922bbe614fbfcf370464523f7773e |