From 1b6ec7366147d736544552719c3162ec6ba61e9c Mon Sep 17 00:00:00 2001 From: Erin Mullaney <erin.mullaney@torchbox.com> Date: Thu, 10 Jan 2019 11:21:22 -0500 Subject: [PATCH] #805 form cleanup --- opentech/apply/activity/messaging.py | 2 +- opentech/apply/funds/views.py | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/opentech/apply/activity/messaging.py b/opentech/apply/activity/messaging.py index ead826634..b2679fae0 100644 --- a/opentech/apply/activity/messaging.py +++ b/opentech/apply/activity/messaging.py @@ -128,7 +128,7 @@ class ActivityAdapter(AdapterBase): MESSAGES.REVIEWERS_UPDATED: 'reviewers_updated', MESSAGES.NEW_REVIEW: 'Submitted a review', MESSAGES.OPENED_SEALED: 'Opened the submission while still sealed', - MESSAGES.SCREENING: 'Screening status {old_status} to {submission.screening_status}' + MESSAGES.SCREENING: 'Screening status from {old_status} to {submission.screening_status}' } def recipients(self, message_type, **kwargs): diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py index 70d5521ae..152a14486 100644 --- a/opentech/apply/funds/views.py +++ b/opentech/apply/funds/views.py @@ -98,22 +98,17 @@ class ScreeningSubmissionView(DelegatedViewMixin, UpdateView): def form_valid(self, form): screening_status = form.cleaned_data.get('screening_status') - old_status = copy(self.get_object()).screening_status - if old_status: - old_status = f'set from {old_status}' - else: - old_status = 'set' - self.object.screening_status = screening_status - self.object.save(update_fields=['screening_status']) + old = copy(self.get_object()) + response = super().form_valid(form) # Record activity messenger( MESSAGES.SCREENING, request=self.request, user=self.request.user, submission=self.object, - related=old_status, + related=old.screening_status or '-', ) - return super().form_valid(form) + return response @method_decorator(staff_required, name='dispatch') -- GitLab