mirror of https://github.com/veops/cmdb.git
Merge pull request #161 from simontigers/common_setting_format
fix: company info create
This commit is contained in:
commit
1e4033d0a6
|
@ -16,15 +16,16 @@ class CompanyInfoView(APIView):
|
|||
return self.jsonify(CompanyInfoCRUD.get())
|
||||
|
||||
def post(self):
|
||||
info = CompanyInfoCRUD.get()
|
||||
if info:
|
||||
abort(400, ErrFormat.company_info_is_already_existed)
|
||||
data = {
|
||||
'info': {
|
||||
**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()
|
||||
return self.jsonify(res)
|
||||
|
||||
|
|
Loading…
Reference in New Issue