From 1ca46f59de57d6a5624a3139320747c9d4c031b8 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 a1ef5edd9..aed187f4a 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 05bb135f8..916d9673c 100644 --- a/opentech/apply/funds/views.py +++ b/opentech/apply/funds/views.py @@ -120,22 +120,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