physics_workload.app.models.academic_group

Attributes

Classes

AcademicGroup

Academic group, e.g. Astro, Theory, QLM...

Functions

is_group_member(→ bool)

Is this user a member of this group?

Module Contents

physics_workload.app.models.academic_group.logger: logging.Logger
physics_workload.app.models.academic_group.User
class physics_workload.app.models.academic_group.AcademicGroup

Bases: app.models.common.ModelCommon

Academic group, e.g. Astro, Theory, QLM…

Named AcademicGroup to avoid collision with base Django Group, which is more about user permissions.

icon = 'users'
url_root = 'group'
code
short_name
name
load_balance_final
load_balance_historic
class Meta
ordering = ('name',)
verbose_name = 'Group'
verbose_name_plural = 'Groups'
__str__()
get_absolute_url() str
get_absolute_url_if_permitted(user) str | None
get_short_name() str
Returns:

The short name. Needed for parity with the Unit model, for Task ownership.

get_instance_header(text: str | None = None) str

Uses the full name for the header of one of these.

Parameters:

text – Text of the header, unused.

Returns:

A rendered header string with the name of the instance.

update_load() bool

Updates the load balance for the group

Returns:

True if the load has changed.

get_load_balance() int

Gets the load balance of all the group members.

Returns:

The load balance.

physics_workload.app.models.academic_group.is_group_member(user: User, academic_group: AcademicGroup) bool

Is this user a member of this group? :param user: :param academic_group: :return: