Previous topic

stalker.core.models.user

Next topic

stalker.core.models.version

This Page

stalker.core.models.user.User

Inheritance diagram of stalker.core.models.user.User

class stalker.core.models.user.User(department=None, email='', first_name='', last_name='', login_name='', password='', permission_groups=[], projects=[], projects_lead=[], sequences_lead=[], tasks=[], last_login=None, initials='', **kwargs)[source]

Bases: stalker.core.models.entity.Entity

The user class is designed to hold data about a User in the system.

Parameters:
  • email – holds the e-mail of the user, should be in [part1]@[part2] format
  • login_name – it is the login name of the user, it should be all lower case. Giving a string or unicode that has uppercase letters, it will be converted to lower case. It can not be an empty string or None and it can not contain any white space inside. login_name parameter will be copied over name if both of them is given, if one of them given they will have the same value which is the formatted login_name value. Setting the name value also sets the login_name and setting the login_name property also sets the name, while creating a User object you don’t need to specify both of them, one is enough and if the two is given login_name will be used.
  • first_name – it is the first name of the user, must be a string or unicode, middle name also can be added here, so it accepts white-spaces in the variable, but it will truncate the white spaces at the beginin and at the end of the variable and it can not be empty or None
  • last_name – it is the last name of the user, must be a string or unicode, again it can not contain any white spaces at the beggining and at the end of the variable and it can be an empty string or None
  • department – it is the department of the current user. It should be a Department object. One user can only be listed in one department. A user is allowed to have no department to make it easy to create a new user and create the department and assign the user it later.
  • password – it is the password of the user, can contain any character and it should be scrambled by using the key from the system preferences
  • permission_groups – it is a list of permission groups that this user is belong to
  • tasks – it is a list of Task objects which holds the tasks that this user has been assigned to
  • projects – it is a list of Project objects which holds the projects that this user is a part of
  • projects_lead – it is a list of Project objects that this user is the leader of, it is for back refefrencing purposes
  • sequences_lead – it is a list of Sequence objects that this user is the leader of, it is for back referencing purposes
  • last_login – it is a datetime.datetime object holds the last login date of the user (not implemented yet)
  • initials – it is the initials of the users name, if nothing given it will be calculated from the first and last names of the user
__init__(department=None, email='', first_name='', last_name='', login_name='', password='', permission_groups=[], projects=[], projects_lead=[], sequences_lead=[], tasks=[], last_login=None, initials='', **kwargs)[source]

Methods

__init__(**kwargs[, department, email, ...])

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
department department of the user, it is a
description Description of this object.
email email of the user, accepts strings or unicodes
first_name first name of the user, accepts string or unicode
initials
last_login last login time of the user as a datetime.datetime instance
last_name last name of the user, accepts string or unicode
login_name login name of the user, accepts string or unicode, also sets
name the name of the user object, it is the synonym for the
nice_name The nice name of this object.
notes all the notes about this entity, it should be a list of Notes
password password of the user, it is scrambled before stored in the
permission_groups permission groups that this users is a member of, accepts
projects projects those the current user assigned to, accepts
projects_lead projects lead by this current user, accepts
sequences_lead sequences lead by this user, accpets
tags a list of Tag objects which shows the related tags to the
tasks tasks assigned to the current user, accepts
updated_by The User who has updated
department[source]

department of the user, it is a Department object

email[source]

email of the user, accepts strings or unicodes

first_name[source]

first name of the user, accepts string or unicode

last_login[source]

last login time of the user as a datetime.datetime instance

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.

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.

last_name[source]

last name of the user, accepts string or unicode

login_name[source]

login name of the user, accepts string or unicode, also sets the name attribute

name[source]

the name of the user object, it is the synonym for the login_name

password[source]

password of the user, it is scrambled before stored in the _password attribute

permission_groups[source]

permission groups that this users is a member of, accepts Group object

projects[source]

projects those the current user assigned to, accepts Project object

projects_lead[source]

projects lead by this current user, accepts Project object

sequences_lead[source]

sequences lead by this user, accpets Sequence objects

tasks[source]

tasks assigned to the current user, accepts Task objects