Search code examples
django-viewflowviewflow

Viewflow: what's the best/canonical way to get the current pending task?


I inspected the Process model, and found active_tasks method:

    def active_tasks(self):
        """List of non finished tasks."""
        return self.flow_class.task_class._default_manager \
            .filter(process=self, finished__isnull=True) \
            .order_by('created')

Is this the canonical way to get the pending task by process_instance.active_tasks.first()?


Solution

  • Since Viewflow allows to have several parallel tasks at the same time, You should define what next pending task means by your own in your specific case..

    for the reference you could also look at default next user redirect heuristics - https://github.com/viewflow/viewflow/blob/master/viewflow/flow/views/utils.py#L12