URLs¶
Should you ever need to get the URL – like for a test – for a task you can use
Django’s reverse
. All users follow a simple
pattern consisting of the workflow name (lowercase) and task name, e.g.:
>>> from django.urls import reverse
>>> reverse("workflow_name:task_name", args=[task.pk])
'/url/to/workflow/task/1'
All task URLs need the .Task primary key as an argument. There are some special views that do not like the workflow detail and override view, e.g.:
>>> reverse('welcomeworkflow:start')
'/welcome/start/'
>>> reverse('welcomeworkflow:detail', args=[workflow.object.pk])
'/welcome/1/'
>>> reverse('welcomeworkflow:override', args=[workflow.object.pk])
'/welcome/1/override'
The first example does not need a primary key, since it is a
StartView
and the workflow is not created yet. The latter two
examples are workflow related views. The need the WorkflowState
primary key
as an argument.
Note
The workflow detail view is also available via
Workflow.get_absolute_url()
. The override view is available via
Workflow.get_override_url()
.