stalker.core.models.StatusList — Stalker v0.1.1.a9 documentation

### Navigation

- index
- next |
- previous |
- Stalker v0.1.1.a9 documentation »

# stalker.core.models.StatusList

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

  Bases: `stalker.core.models.Entity`

  Type specific list of `Status` instances.

  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 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 classes or names of classes. For example:
        from stalker.core.models import Status, StatusList, Project

        status_list = [
            Status(name="Waiting To Start", code="WTS"),
            Status(name="On Hold", code="OH"),
            Status(name="In Progress", code="WIP"),
            Status(name="Waiting Review", code="WREV"),
            Status(name="Approved", code="APP"),
            Status(name="Completed", code="CMPLT"),
        ]

        project_status_list = StatusList(
            name="Project Status List",
            statuses=status_list,
            target_entity_type="Project"
        )

        # or
        project_status_list = StatusList(
            name="Project Status List",
            statuses=status_list,
            target_entity_type=Project
        )
  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)

  Methods

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

  Attributes

  `code` | The code name of this object.
  `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` | Nice name of this object.
  `notes` | All the notes about this entity.
  `statuses` | list of `Status` objects,
  `tags` | A list of tags attached to this object.
  `target_entity_type` | the entity type which this StatusList is valid for, usally it
  `type` | The type of the object.
  `updated_by` | The `User` who has updated this object.

  `statuses`

    list of `Status` objects, showing the possible statuses

  `target_entity_type`

    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, StatusList, Asset

        # now create a StatusList valid only for assets
        status1 = Status(name="Waiting To Start", code="WTS")
        status2 = Status(name="Work In Progress", code="WIP")
        status3 = 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. If the code is 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`

    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 is a list of `Note` objects or an empty list, None will be converted to an empty list.

  `tags`

    A list of tags attached to this object.

    It is a list of `Tag` instances which shows the tags of this object

  `type`

    The type of the object.

    It is an instance of `Type` with a proper `target_entity_type`.

  `updated_by`

    The `User` who has updated this object.

### Navigation

- index
- next |
- previous |
- Stalker v0.1.1.a9 documentation »