python - Assign user to tasks automatically (Viewflow, Django) -
i'm using viewflow/django (http://viewflow.io/) , trying assign tasks created dynamic nodes - i'm using same nodes.py in https://github.com/viewflow/viewflow/tree/master/demo/customnode - however, need automatically assign each new task based on information in moctask model (the assignee). however, tasks don't allow assign other specific user object, , don't have access moctask objects (they related foreign key moc, related foreign key mocprocess, flow itself).
my code trying (flows.py):
... split_on_task_assignment = ( dynamicsplit(lambda p: moctask.objects.filter(moc=p.moc).count()) .ifnone(this.end) .next(this.task_completion) ) task_completion = ( flow.view(views.taskcompletion) .permission('moc.is_moc_actor') .assign(this.assign_actors) .next(this.join_on_task_completion) ) ... def assign_actors(self, activation): task = moctask.objects.filter(moc=activation.process.moc, assigned=false).first() task.assigned = true task.save() return user.objects.filter(email=task.assignee).first() however, can't put reference in assign block, i'm not sure how proceed. ideas?
users can assigned inside dynamicsplitactivation when subsequent tasks created
def activate_next(self): if self._split_count: token_source = token.split_token_source( self.task.token, self.task.pk) _ in range(self._split_count): activation = self.flow_task._next.activate( prev_activation=self, token=next(token_source)) activation.activate(..a user..)
Comments
Post a Comment