0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Add core/workflows.py, and move publish_workflow_state out of utils and into that

This commit is contained in:
jacobtm 2019-11-26 11:31:04 +00:00 committed by Matt Westcott
parent 14bcf60d9a
commit 8f5cb357ac
3 changed files with 7 additions and 9 deletions

View File

@ -2575,7 +2575,7 @@ class WorkflowState(models.Model):
verbose_name=_("current task state"))
# allows a custom function to be called on finishing the Workflow successfully.
on_finish = import_string(getattr(settings, 'WAGTAIL_FINISH_WORKFLOW_ACTION', 'wagtail.core.utils.publish_workflow_state'))
on_finish = import_string(getattr(settings, 'WAGTAIL_FINISH_WORKFLOW_ACTION', 'wagtail.core.workflows.publish_workflow_state'))
def __str__(self):
return _("Workflow '{0}' on Page '{1}': {2}").format(self.workflow, self.page, self.status)

View File

@ -160,11 +160,3 @@ class InvokeViaAttributeShortcut:
def __getattr__(self, name):
method = getattr(self.obj, self.method_name)
return method(name)
def publish_workflow_state(workflow_state):
# publish the Page associated with a WorkflowState
if workflow_state.current_task_state:
workflow_state.current_task_state.page_revision.publish()
else:
workflow_state.page.get_latest_revision().publish()

View File

@ -0,0 +1,6 @@
def publish_workflow_state(workflow_state):
# publish the Page associated with a WorkflowState
if workflow_state.current_task_state:
workflow_state.current_task_state.page_revision.publish()
else:
workflow_state.page.get_latest_revision().publish()