Преглед изворни кода

修改房间保存,已有房间名返回已存在

zhangdongming пре 3 година
родитељ
комит
7396761bc9
1 измењених фајлова са 1 додато и 2 уклоњено
  1. 1 2
      Controller/SensorGateway/EquipmentFamilyController.py

+ 1 - 2
Controller/SensorGateway/EquipmentFamilyController.py

@@ -728,8 +728,7 @@ class EquipmentFamilyView(View):
             room_qs = FamilyRoom.objects.filter(family_id=family_id, name=room_name)
 
             if room_qs.exists():
-                room_dict = {'updated_time': now_time, 'name': room_name}
-                room_qs.update(**room_dict)
+                return response.json(174)
             FamilyRoom.objects.create(family_id=family_id, name=room_name, updated_time=now_time,
                                       created_time=now_time)
         return response.json(0)