init
This commit is contained in:
13
web/commons/models/mixin/base.py
Normal file
13
web/commons/models/mixin/base.py
Normal file
@@ -0,0 +1,13 @@
|
||||
class BaseModelMixin:
|
||||
|
||||
def find_by_key(self):
|
||||
...
|
||||
|
||||
def upsert(self):
|
||||
result = self.find_by_key()
|
||||
session = self._db.session
|
||||
if result:
|
||||
session.delete(result)
|
||||
session.flush()
|
||||
session.add(self)
|
||||
session.commit()
|
Reference in New Issue
Block a user