From 80eafbb014266ae43d3e36b0ab92807b79e28d4a Mon Sep 17 00:00:00 2001 From: moanos Date: Sat, 24 May 2025 17:55:28 +0200 Subject: [PATCH] fix: get id correctly --- src/fellchensammlung/api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fellchensammlung/api/views.py b/src/fellchensammlung/api/views.py index 721431b..20a2f9d 100644 --- a/src/fellchensammlung/api/views.py +++ b/src/fellchensammlung/api/views.py @@ -234,7 +234,7 @@ class RescueOrganizationApiView(APIView): """ Partially update a rescue organization. """ - org_id = kwargs.get("id") + org_id = request.data.get("id") if not org_id: return Response({"error": "ID is required for updating."}, status=status.HTTP_400_BAD_REQUEST) @@ -243,7 +243,7 @@ class RescueOrganizationApiView(APIView): except RescueOrganization.DoesNotExist: return Response({"error": "Organization not found."}, status=status.HTTP_404_NOT_FOUND) - serializer = RescueOrganizationSerializer(organization, data=request.data, partial=True, context={"request": request}) + serializer = RescueOrganizationSerializer(organization, data=request.data, partial=True) if serializer.is_valid(): serializer.save() return Response({"message": "Rescue organization updated successfully!"}, status=status.HTTP_200_OK)