mirror of
https://github.com/veops/cmdb.git
synced 2025-08-08 00:50:22 +08:00
Merge branch 'master' of github.com:veops/cmdb
This commit is contained in:
@@ -16,15 +16,16 @@ class CompanyInfoView(APIView):
|
|||||||
return self.jsonify(CompanyInfoCRUD.get())
|
return self.jsonify(CompanyInfoCRUD.get())
|
||||||
|
|
||||||
def post(self):
|
def post(self):
|
||||||
info = CompanyInfoCRUD.get()
|
|
||||||
if info:
|
|
||||||
abort(400, ErrFormat.company_info_is_already_existed)
|
|
||||||
data = {
|
data = {
|
||||||
'info': {
|
'info': {
|
||||||
**request.values
|
**request.values
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d = CompanyInfoCRUD.create(**data)
|
info = CompanyInfoCRUD.get()
|
||||||
|
if info:
|
||||||
|
d = CompanyInfoCRUD.update(info.get('id'), **data)
|
||||||
|
else:
|
||||||
|
d = CompanyInfoCRUD.create(**data)
|
||||||
res = d.to_dict()
|
res = d.to_dict()
|
||||||
return self.jsonify(res)
|
return self.jsonify(res)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user