|
@@ -70,6 +70,8 @@ class DeviceManagement(View):
|
|
|
return self.get_app_bundle_id_list(response)
|
|
|
elif operation == 'editAppDeviceType': # 编辑app设备类型数据
|
|
|
return self.edit_app_device_type(request_dict, response)
|
|
|
+ elif operation == 'deleteAppDeviceType': # 删除app设备类型数据
|
|
|
+ return self.delete_app_device_type(request_dict, response)
|
|
|
else:
|
|
|
return response.json(444, 'operation')
|
|
|
|
|
@@ -449,3 +451,18 @@ class DeviceManagement(View):
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
return response.json(500, repr(e))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def delete_app_device_type(request_dict, response):
|
|
|
+ app_bundle_id = request_dict.get('appBundleId', None)
|
|
|
+ app_device_type_id = request_dict.get('appDeviceTypeId', None)
|
|
|
+ if not all([app_bundle_id, app_device_type_id]):
|
|
|
+ return response.json(444)
|
|
|
+ try:
|
|
|
+ app_bundle_qs = AppBundle.objects.get(id=app_bundle_id)
|
|
|
+ app_device_type_qs = AppDeviceType.objects.filter(id=app_device_type_id)
|
|
|
+ app_bundle_qs.app_device_type.remove(*app_device_type_qs)
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(500, repr(e))
|