|
@@ -117,7 +117,9 @@ class DeviceManagement(View):
|
|
|
@staticmethod
|
|
|
def add_app_device_type(request_dict, response):
|
|
|
# 添加APP设备类型
|
|
|
- id = request_dict.get('id', None)
|
|
|
+ app_bundle = request_dict.get(
|
|
|
+ 'AppBundle', '')[
|
|
|
+ 1:-1].split(',') # '[1,2]' -> ['1','2']
|
|
|
# app_device_type表数据
|
|
|
model = request_dict.get('model', None)
|
|
|
type = request_dict.get('type', None)
|
|
@@ -136,9 +138,10 @@ class DeviceManagement(View):
|
|
|
app_device_type_qs = AppDeviceType.objects.create(model=model, type=type, icon=icon)
|
|
|
DeviceNameLanguage.objects.create(lang=lang, name=name, sort=sort,
|
|
|
app_device_type_id=app_device_type_qs.id)
|
|
|
- app_bundle_qs = AppBundle.objects.filter(id=id).values('id')
|
|
|
- app_bundle_qs = app_bundle_qs[0]['id']
|
|
|
- app_device_type_qs.appbundle_set.add(app_bundle_qs)
|
|
|
+ for app_id in app_bundle:
|
|
|
+ app_bundle_qs = AppBundle.objects.filter(id=app_id).values('id')
|
|
|
+ app_bundle_qs = app_bundle_qs[0]['id']
|
|
|
+ app_device_type_qs.appbundle_set.add(app_bundle_qs)
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
|
print(e)
|