From 4afe8e900e71bb97f396c11d9eaac731a32e560a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 15 Oct 2019 20:33:37 -0500 Subject: [PATCH] Don't bug out if stores, departments fields aren't present for Employee --- tailbone/views/employees.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tailbone/views/employees.py b/tailbone/views/employees.py index fcc63ad4..488e1f65 100644 --- a/tailbone/views/employees.py +++ b/tailbone/views/employees.py @@ -211,6 +211,8 @@ class EmployeesView(MasterView): return employee def update_stores(self, employee, data): + if 'stores' not in data: + return old_stores = set([s.uuid for s in employee.stores]) new_stores = data['stores'] for uuid in new_stores: @@ -222,6 +224,8 @@ class EmployeesView(MasterView): employee.stores.remove(store) def update_departments(self, employee, data): + if 'departments' not in data: + return old_depts = set([d.uuid for d in employee.departments]) new_depts = data['departments'] for uuid in new_depts: