Package hm :: Package db :: Module log :: Class Action
[hide private]
[frames] | no frames]

Class Action

source code


Nested Classes [hide private]
  Admin
  DoesNotExist
  MultipleObjectsReturned

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

Instance Methods [hide private]
 
items(self) source code
 
__unicode__(self) source code
 
AddManipulator(...)
 
ChangeManipulator(...)
 
get_next_by_time(*moreargs, **morekwargs)
 
get_previous_by_time(*moreargs, **morekwargs)
 
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)
_apply takes a list of models and to each model it:
  1. adds ActionTarget as a base class (in __bases__) to provide a common interface to the models;
  2. assigns an instance of ActionTargetManager to actions which limits the scope to within a single model
  3. registers listeners to call methods in Log regarding events on subclassed models; specifically:
    1. Log.log_save is called before a row is saved
    2. Log.log_create is called after a row is created
    3. Log.log_delete is called before a row is deleted (this should not happen.)
source code
NoneType
on_save(klass, signal, sender, instance)
This method called anytime an object is about to be saved. This is where we can check the instance.original_values dict to determine whether the object has been changed.

From here, we can raise an exception to stop the object from being saved. This is currently not done, but will eventually check for the logged-in status of the user.

source code
NoneType
on_create(klass, signal, sender, instance, created)
This method is called every time an object has been saved. This is where Action objects are created for new objects.
source code
NoneType
on_delete(klass, signal, sender, instance)
This method is called every time an object is deleted. This should not happen with the current database setup.
source code
QuerySet
by_user(klass, user)
Returns a QuerySet containing all Actions for which the specific User is responsible.
source code
 
make(klass, item, type=1, label='<no label>', description='', ip='', user=None)
Instantiates, but does not save, a new Action object.
source code
 
by_item(klass, item) source code
 
by_action(klass, action) source code

Inherited from utils.ModelMixin: add, find, get

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

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

Class Variables [hide private]
  ACTING_MODELS = [<class 'hm.db.graph.Node'>, <class 'hm.db.gra...
  CREATE = 1
  type = models.PositiveIntegerField(default= 0)
  label = models.CharField(max_length= 255)
  description = models.TextField()
  _default_manager = <django.db.models.manager.Manager object at...
  _meta = <Options for Action>
Instance Variables [hide private]
User user = models.ForeignKey(User)
The User associated with this activity.
string ip = models.IPAddressField()
The IP address used when the activity occurred.
datetime time = models.DateTimeField(auto_now_add= True)
The time the activity occurred.
int (an id in the ContentTypes table) item_type = models.ForeignKey(ContentType)
This is an index into the django_content_types table, which stores a row for each model in the application.
int item_id = models.PositiveIntegerField()
This is the primary key of the affected item.
Any item = generic.GenericForeignKey('item_type', 'item_id')
This is a polymorphic link to the affected item.
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

on_save(klass, signal, sender, instance)
Class Method

source code 
Returns: NoneType
None

on_create(klass, signal, sender, instance, created)
Class Method

source code 
Returns: NoneType
None

on_delete(klass, signal, sender, instance)
Class Method

source code 
Returns: NoneType
None

make(klass, item, type=1, label='<no label>', description='', ip='', user=None)
Class Method

source code 
Parameters:
  • item (Any) - The object this action concerns.
  • type (int) - The type of Action. See the list of types in Action.
  • label (string) - A brief description of the activity being recorded.
  • description (string) - The description of the action being created. This defaults to the empty string if none is provided.

items(self)

source code 

by_item(klass, item)
Class Method

source code 

by_action(klass, action)
Class Method

source code 

Class Variable Details [hide private]

ACTING_MODELS

Value:
[<class 'hm.db.graph.Node'>,
 <class 'hm.db.graph.NodeType'>,
 <class 'hm.db.graph.NodeTypeCast'>,
 <class 'hm.db.graph.Edge'>,
 <class 'hm.db.graph.EdgeType'>,
 <class 'hm.db.graph.EdgeTypeCast'>,
 <class 'hm.db.graph.Argument'>,
 <class 'hm.db.graph.Dimension'>,
...

_default_manager

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