From 273f0425607dc39b1a385c6394cfa6d5fd75a2b3 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Mon, 5 Mar 2018 17:40:04 +0000
Subject: [PATCH] Ensure that we grab the old lead from the database

---
 opentech/apply/funds/views.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py
index 31b4536c2..21bbdb86c 100644
--- a/opentech/apply/funds/views.py
+++ b/opentech/apply/funds/views.py
@@ -72,7 +72,8 @@ class UpdateLeadView(DelegatedViewMixin, UpdateView):
     context_name = 'lead_form'
 
     def form_valid(self, form):
-        old_lead = form.instance.lead
+        # Fetch the old lead from the database
+        old_lead = self.get_object().lead
         response = super().form_valid(form)
         new_lead = form.instance.lead
         Activity.actions.create(
-- 
GitLab