Previous topic

stalker.core.models.status.Status

Next topic

stalker.core.models.structure

This Page

stalker.core.models.status.StatusList

Inheritance diagram of stalker.core.models.status.StatusList

class stalker.core.models.status.StatusList(statuses=[], target_entity_type='', **kwargs)[source]

Bases: stalker.core.models.entity.Entity

the type specific list of Status

Holds multiple statuses to be used as a choice list for several other classes.

A StatusList can only be assigned to only one entity type. So a Project can only have a suitable StatusList object which is designed for Project entities.

The list of statuses in StatusList can be accessed by using a list like indexing and it also supports string indexes only for getting the item, you can not set an item with string indices:

>>> from stalker.core.models.status import Status, StatusList
>>> status1 = Status(name="Complete", code="CMPLT")
>>> status2 = Status(name="Work in Progress", code="WIP")
>>> status3 = Status(name="Pending Review", code="PRev")
>>> a_status_list = StatusList(name="Asset Status List",
                               statuses=[status1, status2, status3],
                               target_entity_type="Asset")
>>> a_status_list[0]
<Status (Complete, CMPLT)>
>>> a_status_list["complete"]
<Status (Complete, CMPLT)>
>>> a_status_list["wip"]
<Status (Work in Progress, WIP)>
Parameters:
  • statuses – this is a list of status objects, so you can prepare different StatusList objects for different kind of entities
  • target_entity_type

    use this parameter to specify the target entity type that this StatusList is designed for. It accepts entity_type names. For example:

    from stalker.core.models import status, project
    
    status_list = [
        status.status(name="Waiting To Start", code="WTS"),
        status.status(name="On Hold", code="OH"),
        status.status(name="In Progress", code="WIP"),
        status.status(name="Waiting Review", code="WREV"),
        status.status(name="Approved", code="APP"),
        status.status(name="Completed", code="CMPLT"),
    ]
    
    project_status_list = status.statusList(
        name="Project Status List",
        statuses=status_list,
        target_type=project.Project.entit_type
    )
    

    now with the code above you can not assign the project_status_list object to any other class than a Project object.

__init__(statuses=[], target_entity_type='', **kwargs)[source]

Methods

__init__(**kwargs[, statuses, ...])

Attributes

code The code name of this object.
created_by The User who has created
date_created A datetime.datetime instance showing the creation
date_updated A datetime.datetime instance showing the update
description Description of this object.
name name of this object
nice_name The nice name of this object.
notes all the notes about this entity, it should be a list of Notes
statuses list of Status objects,
tags a list of Tag objects which shows the related tags to the
target_entity_type the entity type which this StatusList is valid for, usally it
updated_by The User who has updated
statuses[source]

list of Status objects, showing the possible statuses

target_entity_type[source]

the entity type which this StatusList is valid for, usally it is set to the TargetClass.entity_type class attribute of the target class:

from stalker.core.models import status, asset

# now create a StatusList valid only for assets
status1 = status.Status(name="Waiting To Start", code="WTS")
status2 = status.Status(name="Work In Progress", code="WIP")
status3 = status.Status(name="Complete", code="CMPLT")
code

The code name of this object.

It accepts string or unicode values and any other kind of objects will be converted to string. In any update to the name attribute the code also will be updated to the uppercase form of the nice_name attribute. If the not initialized or given as None, it will be set to the uppercase version of the nice_name attribute. Setting the code attribute to None will reset it to the default value. The default value is the upper case form of the nice_name.

created_by

The User who has created this object.

date_created

A datetime.datetime instance showing the creation date and time of this object.

date_updated

A datetime.datetime instance showing the update date and time of this object.

description

Description of this object.

name

name of this object

nice_name

The nice name of this object.

It has the same value with the name (contextually) but with a different format like, all the white spaces replaced by underscores (“_”), all the CamelCase form will be expanded by underscore (_) characters and it is always lower case.

There is also the code attribute which is simply the upper case form of nice_name if it is not defined differently (i.e set to another value).

notes

all the notes about this entity, it should be a list of Notes objects or an empty list, None is not accepted

tags

a list of Tag objects which shows the related tags to the entity

updated_by

The User who has updated this object.