From a5f9df3ecf97ee9ccf655ac7b6696034bc040d14 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 12 Jul 2024 14:00:35 +0200 Subject: [PATCH] fix thumbnail as read only in API --- backend/project/api/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/project/api/views.py b/backend/project/api/views.py index f8c55e8..d391025 100644 --- a/backend/project/api/views.py +++ b/backend/project/api/views.py @@ -1,5 +1,4 @@ from django_filters.rest_framework import DjangoFilterBackend -from drf_spectacular.utils import extend_schema from rest_framework import permissions, status, viewsets from rest_framework.decorators import action from rest_framework.generics import GenericAPIView, get_object_or_404 @@ -99,7 +98,6 @@ def get_queryset(self): def perform_create(self, serializer): serializer.save(observer=self.request.user) - @extend_schema(request=MediaSerializer, responses={204: None}, methods=["POST"]) @action( detail=True, methods=["post"], @@ -116,6 +114,7 @@ def add_media(self, request, *args, **kwargs): @action( detail=True, + serializer_class=MediaSerializer, methods=["delete", "patch"], url_path=r"medias/(?P[^/.]+)", )