|
@@ -1993,11 +1993,16 @@ class DeviceManagement(View):
|
|
|
)
|
|
|
assert resp.status < 300
|
|
|
|
|
|
- BaiduBigModelLicense.objects.create(
|
|
|
- license_name=license_name,
|
|
|
- created_time=now_time,
|
|
|
- updated_time=now_time
|
|
|
- )
|
|
|
+ # 更新或创建数据
|
|
|
+ license_qs = BaiduBigModelLicense.objects.filter(license_name=license_name)
|
|
|
+ if license_qs.exists():
|
|
|
+ license_qs.update(updated_time=now_time)
|
|
|
+ else:
|
|
|
+ BaiduBigModelLicense.objects.create(
|
|
|
+ license_name=license_name,
|
|
|
+ created_time=now_time,
|
|
|
+ updated_time=now_time
|
|
|
+ )
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|