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:
parent
14bcf60d9a
commit
8f5cb357ac
@ -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)
|
||||
|
@ -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()
|
||||
|
6
wagtail/core/workflows.py
Normal file
6
wagtail/core/workflows.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user