chenjunkai 6 years ago
parent
commit
7f98a81f0e
1 changed files with 4 additions and 11 deletions
  1. 4 11
      Controller/DeviceManage.py

+ 4 - 11
Controller/DeviceManage.py

@@ -104,17 +104,10 @@ class DeviceManage(View):
     def delete(self, request_dict, userID, response):
         own_perm = ModelService.check_permission(userID=userID, permID=10)
         if own_perm is True:
-            id_list = request_dict.getlist('id', None)
-            if id_list:
-                try:
-                    for id in id_list:
-                        Device_Info.objects.filter(id=id).delete()
-                except Exception as e:
-                    errorInfo = traceback.format_exc()
-                    print(errorInfo)
-                    return response.json(424, {'details': repr(e)})
-                else:
-                    return response.json(0)
+            id = request_dict.get('id', None)
+            if id:
+                Device_Info.objects.filter(id=id).delete()
+                return response.json(0)
             else:
                 return response.json(444,'id must list')
         else: