physics_workload.app.models.staff

Attributes

Classes

Staff

Member of staff; not necessarily a current user.

Functions

update_staff_link(sender, instance, created, **kwargs)

Link newly created CustomUser to a staff member.

Module Contents

physics_workload.app.models.staff.logger: logging.Logger
class physics_workload.app.models.staff.Staff

Bases: app.models.common.ModelCommon

Member of staff; not necessarily a current user.

Attribute icon:

Icon to use in the front end.

Attribute url_root:

Root URL for the model.

Attribute user:

The user account corresponding to this staff member, may be none.

Attribute account:

The active directory account name for this staff member.

Attribute name:

The name of this staff member.

DYNAMIC_FIELDS = ['load_balance_historic', 'load_balance_final', 'load_target', 'load_assigned']
icon = 'user'
url_root = 'staff'
user
account
name
academic_group
gender
load_target
load_assigned
load_external
hours_fixed
fte_fraction
load_balance_final
load_balance_historic
notes
class Meta
ordering = ['name']
verbose_name = 'Staff Member'
verbose_name_plural = 'Staff Members'
indexes
constraints
has_access(user: django.contrib.auth.models.AbstractUser | django.contrib.auth.models.AnonymousUser) bool

Does the user have access to this object?

Parameters:

user – The user in question.

Returns:

True if the user has access, or the user is this staff member.

__str__()

Default rendering of a staff member shows their load balance

Returns:

Their name plus load balance.

get_instance_header(text: str | None = None) str

Creates a header for staff, without their load balance in.

Parameters:

text – Ignored, only exists to match signature.

Returns:

A header with just the name.

get_load_balance()

Gets how much under or overloaded the staff member is.

Returns:

The balance of assigned load against target load, negative if underloaded.

update_load_assigned()

Updates own assigned load by summing the load of the assignments.

Returns:

True if the total load has changed, false if not.

update_load_target()

Updates the target load from the standard load settings.

Returns:

True if the load target has changed, false if not.

Link newly created CustomUser to a staff member.

Parameters:
  • sender

  • instance

  • created

  • kwargs

Returns: