From 22a419cb87a1d9b3485482eeb48ac1a2d8a04642 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Mon, 12 Feb 2018 16:13:46 +0000 Subject: [PATCH] include the correct workflow on the page on creation --- opentech/apply/funds/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opentech/apply/funds/models.py b/opentech/apply/funds/models.py index a4a3fe601..47ce6c968 100644 --- a/opentech/apply/funds/models.py +++ b/opentech/apply/funds/models.py @@ -275,10 +275,16 @@ class Round(WorkflowStreamForm, SubmittableStreamForm): ObjectList(SubmittableStreamForm.promote_panels, heading='Promote'), ]) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # We attached the parent page as part of the before_create_hook + if hasattr(self, 'parent_page'): + self.workflow = self.parent_page.workflow + def save(self, *args, **kwargs): is_new = not self.id if is_new and hasattr(self, 'parent_page'): - # We attached the parent page as part of the before_create_hook + # Ensure that the workflow hasn't changed self.workflow = self.parent_page.workflow super().save(*args, **kwargs) -- GitLab