Skip to content

Workflow

hypha.apply.funds.workflows.models.workflow

Workflow

Workflow(name, admin_name, **data)

Bases: dict

Source code in hypha/apply/funds/workflows/models/workflow.py
5
6
7
8
def __init__(self, name, admin_name, **data):
    self.name = name
    self.admin_name = admin_name
    super().__init__(**data)

name instance-attribute

name = name

admin_name instance-attribute

admin_name = admin_name

stages property

stages

stepped_phases property

stepped_phases

phases_for

phases_for(user=None)
Source code in hypha/apply/funds/workflows/models/workflow.py
def phases_for(self, user=None):
    # Grab the first phase for each step - visible only, the display phase
    return [
        phase
        for phase, *_ in self.stepped_phases.values()
        if not user or phase.permissions.can_view(user)
    ]

previous_visible

previous_visible(current, user)

Find the latest phase that the user has view permissions for

Source code in hypha/apply/funds/workflows/models/workflow.py
def previous_visible(self, current, user):
    """Find the latest phase that the user has view permissions for"""
    display_phase = self.stepped_phases[current.step][0]
    phases = self.phases_for()
    index = phases.index(display_phase)
    for phase in phases[index - 1 :: -1]:
        if phase.permissions.can_view(user):
            return phase