Package hm :: Package db :: Module rating :: Class Rating
[hide private]
[frames] | no frames]

Class Rating

source code


Nested Classes [hide private]
  Admin
  DoesNotExist
  MultipleObjectsReturned

Inherited from django.db.models.base.Model: __metaclass__

Instance Methods [hide private]
 
__unicode__(self) source code
 
AddManipulator(...)
 
ChangeManipulator(...)
 
objects(...)

Inherited from django.db.models.base.Model: __eq__, __init__, __ne__, __repr__, __str__, delete, save, validate

Inherited from django.db.models.base.Model (private): _collect_sub_objects, _get_FIELD_display, _get_FIELD_filename, _get_FIELD_height, _get_FIELD_size, _get_FIELD_url, _get_FIELD_width, _get_image_dimensions, _get_next_or_previous_by_FIELD, _get_next_or_previous_in_order, _get_pk_val, _save_FIELD_file, _set_pk_val

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]
NoneType
Initialize(klass)
Mixes the RatingMixin class into the Model classes specified in Rating.RATEABLE_MODELS
source code

Inherited from django.db.models.base.Model: add_to_class

Inherited from django.db.models.base.Model (private): _prepare

Static Methods [hide private]
QuerySet
by_item_and_user(item, user=None)
Returns a QuerySet containing the single Rating object (if any) made by the specified User on the specified object.
source code
QuerySet
by_item(item)
Returns a QuerySet containing all the Rating objects for the specified item.
source code
Rating
add(item, score, user=None)
This method overrides the one in the ModelMixin class, because it must check many more aspects than any other model.
source code
Class Variables [hide private]
list<models.Model> RATEABLE_MODELS = [<class 'hm.db.graph.Node'>, <class 'hm.db.g...
dict<key:(low, high, type)> ACCEPTABLE_RANGE = {<class 'hm.db.graph.Edge'>: (0, 10, <type ...
  _default_manager = <django.db.models.manager.Manager object at...
  _meta = <Options for Rating>
Instance Variables [hide private]
int score = models.IntegerField()
The important part
int, or ContentType item_type = models.ForeignKey(ContentType)
The ContentType id of item
int item_id = models.PositiveIntegerField()
The id of item in the appropriate table
Any item = generic.GenericForeignKey('item_type', 'item_id')
The object this Rating references
Properties [hide private]

Inherited from django.db.models.base.Model: pk

Inherited from object: __class__

Method Details [hide private]

Initialize(klass)
Class Method

source code 
Returns: NoneType
None

add(item, score, user=None)
Static Method

source code 
Returns: Rating
Returns the new Rating object, if successful.
Raises:

See Also: Rating for information about parameters and types.


Class Variable Details [hide private]

RATEABLE_MODELS

Type:
list<models.Model>
Value:
[<class 'hm.db.graph.Node'>,
 <class 'hm.db.graph.Edge'>,
 <class 'hm.db.graph.Argument'>,
 <class 'hm.db.graph.Dimension'>,
 <class 'hm.db.graph.Behavior'>,
 <class 'hm.db.graph.UPC'>,
 <class 'hm.db.citation.Source'>,
 <class 'hm.db.citation.Author'>,
...

ACCEPTABLE_RANGE

Type:
dict<key:(low, high, type)>
Value:
{<class 'hm.db.graph.Edge'>: (0, 10, <type 'int'>),
 <class 'hm.db.graph.Node'>: (0, 10, <type 'int'>),
 <class 'hm.db.graph.UPC'>: (0, 10, <type 'int'>),
 <class 'hm.db.graph.Dimension'>: (0, 10, <type 'int'>),
 <class 'hm.db.graph.Behavior'>: (0, 10, <type 'int'>),
 <class 'hm.db.graph.Argument'>: (-1, 1, <type 'int'>),
 <class 'hm.db.citation.Source'>: (0, 10, <type 'int'>),
 <class 'hm.db.citation.Author'>: (0, 10, <type 'int'>),
...

_default_manager

Value:
<django.db.models.manager.Manager object at 0x4085ab4c>