From 5534fda8bf56c5de4bc62b21209a83a49d753170 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 14 Aug 2019 17:46:54 +0800 Subject: [PATCH] crud --- sqlor/crud.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sqlor/crud.py b/sqlor/crud.py index 7a0cdae..f61da17 100755 --- a/sqlor/crud.py +++ b/sqlor/crud.py @@ -197,8 +197,9 @@ class CRUD(object): pk = await self.primaryKey() k = pk[0]['field_name'] - v = getID() - data[k] = v + if not data.get(k): + v = getID() + data[k] = v data = self.oa.execute(self.dbname+'_'+self.tablename,'beforeAdd',data) await addSQL(self.dbname,data) data = self.oa.execute(self.dbname+'_'+self.tablename,'afterAdd',data)