From 69084cc89a58ebd9f7fc03f553f1c7bd9799939c Mon Sep 17 00:00:00 2001 From: imanirak Date: Sat, 23 Apr 2022 21:00:03 -0400 Subject: [PATCH] final device = last employee created name --- main_app/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main_app/views.py b/main_app/views.py index 38e6653..b6f4f81 100644 --- a/main_app/views.py +++ b/main_app/views.py @@ -129,10 +129,11 @@ def form_valid(self,form): self.object.user = self.request.user device_type = self.object.device_type device = self.object - #update name based on last created employee employee = Employee.objects.last() - device.name = employee + device_name = employee + + device.name = device_name device.save(['name'])