From 239c95660df63a01276f50ff6c4be1933ec06b81 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Wed, 22 Aug 2018 17:26:56 +0100 Subject: [PATCH] make sure the user is included on the initial revision --- opentech/apply/funds/models/submissions.py | 6 +++++- opentech/apply/funds/tests/test_models.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/opentech/apply/funds/models/submissions.py b/opentech/apply/funds/models/submissions.py index 779f551c6..3f9500018 100644 --- a/opentech/apply/funds/models/submissions.py +++ b/opentech/apply/funds/models/submissions.py @@ -459,7 +459,11 @@ class ApplicationSubmission( if creating: self.reviewers.set(self.get_from_parent('reviewers').all()) - first_revision = ApplicationRevision.objects.create(submission=self, form_data=self.form_data) + first_revision = ApplicationRevision.objects.create( + submission=self, + form_data=self.form_data, + author=self.user, + ) self.live_revision = first_revision self.draft_revision = first_revision self.save() diff --git a/opentech/apply/funds/tests/test_models.py b/opentech/apply/funds/tests/test_models.py index b4e043677..0d30437d7 100644 --- a/opentech/apply/funds/tests/test_models.py +++ b/opentech/apply/funds/tests/test_models.py @@ -381,6 +381,7 @@ class TestApplicationSubmission(TestCase): submission = ApplicationSubmissionFactory() self.assertEqual(submission.revisions.count(), 1) self.assertDictEqual(submission.live_revision.form_data, submission.form_data) + self.assertEqual(submission.live_revision.author, submission.user) def test_create_revision_on_data_change(self): submission = ApplicationSubmissionFactory() -- GitLab