stalker.models.mixins.StatusMixin

Inheritance diagram of stalker.models.mixins.StatusMixin
class stalker.models.mixins.StatusMixin(status=None, status_list=None, **kwargs)

Bases: object

Makes the mixed in object statusable.

This mixin adds status and status_list attributes to the mixed in class. Any object that needs a status and a corresponding status list can include this mixin.

When mixed with a class which don’t have an __init__ method, the mixin supplies one, and in this case the parameters below must be defined.

Parameters:
  • status_list

    this attribute holds a status list object, which shows the possible statuses that this entity could be in. This attribute can not be empty or None. Giving a StatusList object, the StatusList.target_entity_type should match the current class.

    New in version 0.1.2.a4: The status_list argument now can be skipped or can be None if there is an active database connection and there is a suitable StatusList instance in the database whom StatusList.target_entity_type attribute is set to the current mixed-in class name.

  • status

    It is a Status instance which shows the current status of the statusable object. Integer values are also accepted, which shows the index of the desired status in the status_list attribute of the current statusable object. If a Status instance is supplied, it should also be present in the status_list attribute. If set to None then the first Status instance in the status_list will be used.

    New in version 0.2.0: Status attribute as Status instance:

    It is now possible to set the status of the instance by a Status instance directly. And the StatusMixin.status will return a proper Status instance.

__init__(status=None, status_list=None, **kwargs)

x.__init__(…) initializes x; see help(type(x)) for signature

Methods

__init__([status, status_list]) x.__init__(…) initializes x; see help(type(x)) for signature

Attributes

status
status_id
status_list
status_list_id