menu

Actions views

class viewflow.flow.views.actions.BaseTaskActionView(**kwargs)

Bases: viewflow.flow.views.mixins.MessageUserMixin, django.views.generic.base.TemplateView

Base class for the basic flow action views.

can_proceed()

Check that action can be executed.

Subclasses should override it.

dispatch(*args, **kwargs)

Activate the task and check the permission.

get_context_data(**kwargs)

Context for a task view.

Parameters:activation – the task activation instance
get_success_url()

Continue on task or redirect back to task list.

get_template_names()

List of template names to be used for a action view.

If template_name is None, default value is:

[<app_label>/<flow_label>/<task_name>_<action_name>.html,
 <app_label>/<flow_label>/task_<action_name>.html,
 'viewflow/flow/task_<action_name>.html'
 'viewflow/flow/task_action.html']
perform()

Peform the action.

Subclasses should override it.

post(request, *args, **kwargs)

Perform the action.

Expect that form submitted with run_action button:

<button type="submit" name="run_action">Perform</button>
class viewflow.flow.views.UndoTaskView(**kwargs)

Bases: viewflow.flow.views.mixins.FlowTaskManagePermissionMixin, viewflow.flow.views.actions.BaseTaskActionView

Undo the task.

can_proceed()

Check that node can be undone.

perform()

Undo the node.

class viewflow.flow.views.CancelTaskView(**kwargs)

Bases: viewflow.flow.views.mixins.FlowTaskManagePermissionMixin, viewflow.flow.views.actions.BaseTaskActionView

Cancel task view.

can_proceed()

Check that node can be cancelled.

perform()

Cancel the node.

class viewflow.flow.views.PerformTaskView(**kwargs)

Bases: viewflow.flow.views.mixins.FlowTaskManagePermissionMixin, viewflow.flow.views.actions.BaseTaskActionView

Non-interactive task that cancelled and need to be started manually.

can_proceed()

Check that gateway can be reexecuted.

perform()

Rerun gateway manually.

class viewflow.flow.views.ActivateNextTaskView(**kwargs)

Bases: viewflow.flow.views.mixins.FlowTaskManagePermissionMixin, viewflow.flow.views.actions.BaseTaskActionView

Activate next task without interactive task redone.

can_proceed()

Check that node in a state allows to activate ountgoing nodes.

perform()

Activite oungoing nodes.

class viewflow.flow.views.CancelProcessView(**kwargs)

Bases: viewflow.flow.views.mixins.FlowManagePermissionMixin, django.views.generic.detail.DetailView

View to cancel a process and all active tasks.

dispatch(request, *args, **kwargs)

Lock the process.

error(message, fail_silently=True, **kwargs)

Notification about an error.

get_context_data(**kwargs)

Context for a task view.

Parameters:
  • active_tasks – List of all tasks not finished at that moment
  • uncancelable_tasks – List of tasks that can’t be cancelled
get_queryset()

Flow processes.

get_success_url()

Continue to the flow index or redirect according ?back parameter.

get_template_names()

List of template names to be used for a cancel view.

If template_name is None, default value is:

[<app_label>/<flow_label>/process_Cancel.html,
 'viewflow/flow/process_cancel.html']
post(request, *args, **kwargs)

Cancel active tasks and the process.

report(message, level=20, fail_silently=True, **kwargs)

Send a notification with link to the current process or task.

Parameters:

A message_template prepared by python .format() function. In addition to kwargs, the {process} parameter passed.

Example:

self.report('{process} has been cancelled.')
success(message, fail_silently=True, **kwargs)

Notification about sucessful operation.