Previous topic

stalker.core.models.entity

Next topic

stalker.core.models.entity.Entity

This Page

stalker.core.models.entity.SimpleEntity

Inheritance diagram of stalker.core.models.entity.SimpleEntity

class stalker.core.models.entity.SimpleEntity(name=None, description='', created_by=None, updated_by=None, date_created=datetime.datetime(2011, 2, 15, 8, 55, 59, 967831), date_updated=datetime.datetime(2011, 2, 15, 8, 55, 59, 967844), code=None, **kwargs)[source]

Bases: object

The base class of all the others

This class has the basic information about an entity which are the name, the description, tags and the audit information like created_by, updated_by, date_created and date_updated about this entity.

Two SimpleEntities considered equal if they have the same name, the other attributes doesn’t matter.

Parameters:
  • name (string) – A string or unicode value that holds the name of this entity. It can not be empty, the first letter should be an alphabetic ([a-zA-z]) (not alphanumeric [a-zA-Z0-9]) letter and it should not contain any white space at the beggining and at the end of the string, giving an object the object will be converted to string and then the resulting string will be conditioned.
  • description (str) – A string or unicode attribute that holds the description of this entity object, it could be an empty string, and it could not again have white spaces at the beggining and at the end of the string, again any given objects will be converted to strings
  • created_by (User) – The User who has created this object
  • updated_by – The User who has updated this object lastly. The created_by and updated_by attributes point the same object if this object is just created.
  • date_created (datetime.datetime) – The date that this object is created.
  • date_updated (datetime.datetime) – The date that this object is updated lastly. For newly created entities this is equal to date_created and thedate_updated cannot point a date which is before date_created.
  • code (str) – The code name of this object. It accepts string or unicode values and any other kind of objects will be converted to string. Can be omitted and it will be set to the uppercase version of the nice_name attribute. If both the name and code arguments are given the code attribute will be set to code, but in any update to name attribute the code also will be updated to the uppercase form of the nice_name attribute. The default value is the upper case form of the nice_name
__init__(name=None, description='', created_by=None, updated_by=None, date_created=datetime.datetime(2011, 2, 15, 8, 55, 59, 967831), date_updated=datetime.datetime(2011, 2, 15, 8, 55, 59, 967844), code=None, **kwargs)[source]

Methods

__init__(2, 15, 8, 55, 59, 2, 15, 8, 55, 59, ...)

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.
updated_by The User who has updated
description[source]

Description of this object.

name[source]

name of this object

nice_name[source]

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).

code[source]

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[source]

The User who has created this object.

updated_by[source]

The User who has updated this object.

date_created[source]

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

date_updated[source]

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