django-critic v0.2.1 documentation
Contents
Arguments expected:
Returns:
The api_model_manager_add already handles changes so this method is simply here for connivence and it calls the api_model_manager_add method.
Arguments expected:
Returns:
Returns the value the user selected for the supplied object
Arguments expected:
Returns:
Returns the average value for the supplied object.
Arguments expected:
Returns:
Returns the total amout of ratings for the supplied object. Optionl argument ‘opt’ can return the total ratings for a particular option.
Arguments expected:
Returns:
A descriptor is added a the models that will be rate-able. The descriptor returns a manager and works the same as Rating Manager but does not require the object to be passed in.
This takes no arguments and returns the average for the instance
Example
>>> obj.ratings.average
>>> 3.5
This takes no arguments and returns the total for the instance.
Example
>>> obj.ratings.total
>>> 213
This returns detailed information about the rating options for an instance.
Example
>>> p = Product.objects.get(pk=1)
>>> p.ratings.data
>>> {'1': {'percentage': 0, 'total': 0},
'2': {'percentage': 0, 'total': 0},
'3': {'percentage': 0, 'total': 0},
'4': {'percentage': 100, 'total': 1},
'5': {'percentage': 0, 'total': 0}}