physics_workload.app.models.task

Attributes

Classes

Task

This is the model for tasks

Functions

update_task_name(sender, instance, **kwargs)

Module Contents

physics_workload.app.models.task.logger: logging.Logger
class physics_workload.app.models.task.Task

Bases: app.models.common.ModelCommon

This is the model for tasks

icon = 'clipboard'
url_root = 'task'
load_calc
load_calc_first
name
title
is_required
is_unique
academic_group
load_fixed
load_fixed_first
load_multiplier
FIELDS_TASK_GENERIC = ('load_function', 'students')
load_function
students
FIELDS_TASK_UNIT_LEAD = ('unit', 'is_lead', 'coursework_fraction', 'exam_fraction')
unit
is_lead
coursework_fraction
exam_fraction
FIELDS_TASK_FULL_TIME = ('is_full_time',)
is_full_time
description
notes
class Meta
ordering = ('unit', 'name')
verbose_name = 'Task'
verbose_name_plural = 'Tasks'
constraints
__str__()
Returns:

The name. We cache it to avoid multiple table queries per display.

get_name() str
Returns:

The name of the task, with unit code if possible

get_name_with_load() str
Returns:

The name of the task, with unit code if possible, and load hours

get_instance_header(text: str | None = None) str

Overrides the default instance header to include the unit, with link, if present. :param text: Override text. :return: The rendered HTML template for this model.

get_absolute_url() str

Preprend the unit if this is a unit task

has_any_provisional() bool
has_any_first_time() bool
has_access(user: django.contrib.auth.models.AbstractUser) bool

Only users assigned to a task can see the details :param user: The user :return: True if the user is assigned to this task

update_load(cascade=True, save=False) True

Updates the load for this task, and any associated assignments.

Parameters:

cascade – If true, update the load for this task and sub-assignments.

Returns:

True if the load has changed, false if not.

calculate_load(students: int | None, is_first_time: bool = False) float
Returns:

physics_workload.app.models.task.update_task_name(sender: Type[Task], instance: Task, **kwargs)
Parameters:
  • sender

  • instance – The updated instance, an in-memory version.

  • kwargs

Returns: