From 461abd2e46d5f961ce8dd2b6022e3e4ae264cac7 Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 26 Jan 2025 17:04:17 +0100 Subject: [PATCH] fix: don't try to save owner --- src/fellchensammlung/api/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fellchensammlung/api/views.py b/src/fellchensammlung/api/views.py index f2b4b25..bec2a77 100644 --- a/src/fellchensammlung/api/views.py +++ b/src/fellchensammlung/api/views.py @@ -16,6 +16,7 @@ from .serializers import ( from fellchensammlung.models import Animal, RescueOrganization, AdoptionNotice, Species, Image from drf_spectacular.utils import extend_schema + class AdoptionNoticeApiView(APIView): permission_classes = [IsAuthenticated] @@ -84,7 +85,6 @@ class AdoptionNoticeApiView(APIView): ) - class AnimalApiView(APIView): permission_classes = [IsAuthenticated] @@ -118,6 +118,7 @@ class AnimalApiView(APIView): ) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class RescueOrganizationApiView(APIView): permission_classes = [IsAuthenticated] @@ -159,13 +160,14 @@ class RescueOrganizationApiView(APIView): """ serializer = RescueOrgSerializer(data=request.data, context={"request": request}) if serializer.is_valid(): - rescue_org = serializer.save(owner=request.user) + rescue_org = serializer.save() return Response( {"message": "Rescue organization created/updated successfully!", "id": rescue_org.id}, status=status.HTTP_201_CREATED, ) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class AddImageApiView(APIView): permission_classes = [IsAuthenticated]