physics_workload.app.models.task¶
Attributes¶
Classes¶
This is the model for tasks |
Functions¶
|
|
|
Is the user one of the staff assigned to this task? |
Module Contents¶
- physics_workload.app.models.task.logger: logging.Logger¶
- physics_workload.app.models.task.User¶
- class physics_workload.app.models.task.Task¶
Bases:
app.models.common.ModelCommonThis 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', 'assignment_students')¶
- class AssignmentStudentsChoices(*args, **kwds)¶
Bases:
django.db.models.TextChoicesClass for creating enumerated string choices.
Initialize self. See help(type(self)) for accurate signature.
- OPTIONAL = ('OPTIONAL', 'Optional')¶
- REQUIRED = ('REQUIRED', 'Required')¶
- INVALID = ('INVALID', 'Invalid')¶
- assignment_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
- get_absolute_url_if_permitted(user: User) str | None¶
- has_any_provisional() bool¶
- has_any_first_time() bool¶
- 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: