kopia lustrzana https://github.com/wagtail/wagtail
Split get_next_task query into multiple lines for readability
Co-Authored-By: Matt Westcott <matthew@torchbox.com>pull/6257/head
rodzic
e809e1f262
commit
21e0371b67
|
@ -2864,7 +2864,15 @@ class WorkflowState(models.Model):
|
|||
|
||||
def get_next_task(self):
|
||||
"""Returns the next active task associated with the latest page revision, which has not been either approved or skipped"""
|
||||
return Task.objects.filter(workflow_tasks__workflow=self.workflow, active=True).exclude(task_states__in=TaskState.objects.filter(Q(page_revision=self.page.get_latest_revision()), Q(status=TaskState.STATUS_APPROVED) | Q(status=TaskState.STATUS_SKIPPED))).order_by('workflow_tasks__sort_order').first()
|
||||
return (
|
||||
Task.objects.filter(workflow_tasks__workflow=self.workflow, active=True)
|
||||
.exclude(
|
||||
task_states__in=TaskState.objects.filter(
|
||||
Q(page_revision=self.page.get_latest_revision()),
|
||||
Q(status=TaskState.STATUS_APPROVED) | Q(status=TaskState.STATUS_SKIPPED)
|
||||
)
|
||||
).order_by('workflow_tasks__sort_order').first()
|
||||
)
|
||||
|
||||
def cancel(self, user=None):
|
||||
"""Cancels the workflow state"""
|
||||
|
|
Ładowanie…
Reference in New Issue