浏览代码

增加用户日志

yf_yzl 2 年之前
父节点
当前提交
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")
         plantname = request_data.get("plantname")
         pickcode = request_data.get("pickcode")
         pickcode = request_data.get("pickcode")
         planttype = request_data.get("planttype")
         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:
         if plan:
             return Response({"code": 2, "msg": "该作物种类已存在,请核查"})
             return Response({"code": 2, "msg": "该作物种类已存在,请核查"})
         MongoPlantInfo.objects.filter(id=plan_id).update(
         MongoPlantInfo.objects.filter(id=plan_id).update(