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
17c851f354
|
@ -16,14 +16,15 @@ 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
info = CompanyInfoCRUD.get()
|
||||||
|
if info:
|
||||||
|
d = CompanyInfoCRUD.update(info.get('id'), **data)
|
||||||
|
else:
|
||||||
d = CompanyInfoCRUD.create(**data)
|
d = CompanyInfoCRUD.create(**data)
|
||||||
res = d.to_dict()
|
res = d.to_dict()
|
||||||
return self.jsonify(res)
|
return self.jsonify(res)
|
||||||
|
|
Loading…
Reference in New Issue