From e3a6923fe7ca23e573eb93187473a8f0a215f078 Mon Sep 17 00:00:00 2001 From: Uday Sagar Date: Fri, 29 Mar 2024 15:43:30 +0530 Subject: [PATCH] added limit for import --- care/facility/api/viewsets/asset.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/care/facility/api/viewsets/asset.py b/care/facility/api/viewsets/asset.py index e2d8ca9317..5528d0026f 100644 --- a/care/facility/api/viewsets/asset.py +++ b/care/facility/api/viewsets/asset.py @@ -422,9 +422,8 @@ def bulk_upsert(self, request, *args, **kwargs): if "location" not in request.data: raise ValidationError({"location": "Location is required"}) - limit = request.data.get("limit", None) - if limit is None: - limit = float("inf") + limit = 200 + if len(request.data["assets"]) > limit: raise ValidationError( {"assets": f"Maximum of {limit} assets can be created at once"}