yf_yzl 2 лет назад
Родитель
Сommit
880368f702
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      smartfarming/views/home_land.py

+ 1 - 1
smartfarming/views/home_land.py

@@ -246,7 +246,7 @@ class MongoPlantInfoUpdateAPIView(APIView):
         plantname = request_data.get("plantname")
         pickcode = request_data.get("pickcode")
         planttype = request_data.get("planttype")
-        plan = MongoPlantInfo.objects.filter(plantname=plantname, planttype=planttype)
+        plan = MongoPlantInfo.objects.filter(plantname=plantname, planttype=planttype).exclude(id=plan_id)
         if plan:
             return Response({"code": 2, "msg": "该作物种类已存在,请核查"})
         MongoPlantInfo.objects.filter(id=plan_id).update(