From cc2a659767237ee5d40ae2e5a61e0ab52687bada Mon Sep 17 00:00:00 2001 From: moanos Date: Sat, 24 May 2025 13:06:23 +0200 Subject: [PATCH] feat: only fetch the location if none is given --- src/fellchensammlung/api/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fellchensammlung/api/views.py b/src/fellchensammlung/api/views.py index 3e38619..721431b 100644 --- a/src/fellchensammlung/api/views.py +++ b/src/fellchensammlung/api/views.py @@ -215,8 +215,9 @@ class RescueOrganizationApiView(APIView): serializer = RescueOrganizationSerializer(data=request.data, context={"request": request}) if serializer.is_valid(): rescue_org = serializer.save() - # Add the location - post_rescue_org_save.delay_on_commit(rescue_org.pk) + if rescue_org.location is None: + # Add the location + post_rescue_org_save.delay_on_commit(rescue_org.pk) return Response( {"message": "Rescue organization created successfully!", "id": rescue_org.id}, status=status.HTTP_201_CREATED,