Package coprs :: Module models :: Class Action
[hide private]
[frames] | no frames]

Class Action

source code


Representation of a custom action that needs backends cooperation/admin attention/...

Nested Classes [hide private]

Inherited from flask_sqlalchemy.Model: query_class

Instance Methods [hide private]
 
__str__(self)
str(x)
source code
 
__unicode__(self) source code
 
to_dict(self, **kwargs)
Usage:
source code
 
__init__(self, **kwargs)
A simple constructor that allows initialization from kwargs.
source code

Inherited from unreachable.Model: query

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  id = db.Column(db.Integer, primary_key= True)
  action_type = db.Column(db.Integer, nullable= False)
  object_type = db.Column(db.String(20))
  object_id = db.Column(db.Integer)
  old_value = db.Column(db.String(255))
  new_value = db.Column(db.String(255))
  data = db.Column(db.Text)
  result = db.Column(db.Integer, default= helpers.BackendResultE...
  message = db.Column(db.Text)
  created_on = db.Column(db.Integer)
  ended_on = db.Column(db.Integer)
  __mapper__ = <Mapper at 0x7fee489dd490; Action>
  __table__ = Table('action', MetaData(bind=None), Column('id', ...
  __tablename__ = 'action'
  _sa_class_manager = <ClassManager of <class 'coprs.models.Acti...

Inherited from unreachable.Model: metadata

Inherited from unreachable.Model (private): _decl_class_registry

Properties [hide private]

Inherited from helpers.Serializer: serializable_attributes

Inherited from object: __class__

Method Details [hide private]

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

to_dict(self, **kwargs)

source code 

Usage:

SQLAlchObject.to_dict() => returns a flat dict of the object
SQLAlchObject.to_dict({"foo": {}}) => returns a dict of the object
    and will include a flat dict of object foo inside of that
SQLAlchObject.to_dict({"foo": {"bar": {}}, "spam": {}}) => returns
    a dict of the object, which will include dict of foo
    (which will include dict of bar) and dict of spam.

Options can also contain two special values: __columns_only__
and __columns_except__

If present, the first makes only specified fiels appear,
the second removes specified fields. Both of these fields
must be either strings (only works for one field) or lists
(for one and more fields).

SQLAlchObject.to_dict({"foo": {"__columns_except__": ["id"]},
    "__columns_only__": "name"}) =>

The SQLAlchObject will only put its "name" into the resulting dict,
while "foo" all of its fields except "id".

Options can also specify whether to include foo_id when displaying
related foo object (__included_ids__, defaults to True).
This doesn"t apply when __columns_only__ is specified.

Overrides: helpers.Serializer.to_dict
(inherited documentation)

__init__(self, **kwargs)
(Constructor)

source code 

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in ``kwargs``.

Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.

Overrides: object.__init__

Class Variable Details [hide private]

result

Value:
db.Column(db.Integer, default= helpers.BackendResultEnum("waiting"))

__table__

Value:
Table('action', MetaData(bind=None), Column('id', Integer(), table=<ac\
tion>, primary_key=True, nullable=False), Column('action_type', Intege\
r(), table=<action>, nullable=False), Column('object_type', String(len\
gth=20), table=<action>), Column('object_id', Integer(), table=<action\
>), Column('old_value', String(length=255), table=<action>), Column('n\
ew_value', String(length=255), table=<action>), Column('data', Text(),\
 table=<action>), Column('result', Integer(), table=<action>, default=\
ColumnDefault(0)), Column('message', Text(), table=<action>), Column('\
...

_sa_class_manager

Value:
<ClassManager of <class 'coprs.models.Action'> at 7fee48f14e30>