From 94c646fdb889b7ce4a0a72995c0a843d9d73b78d Mon Sep 17 00:00:00 2001 From: Markos Gogoulos Date: Fri, 20 Sep 2024 19:26:13 +0300 Subject: [PATCH] update metadata only, on API call --- files/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/files/views.py b/files/views.py index 19505a0dd..ea24c9bb7 100644 --- a/files/views.py +++ b/files/views.py @@ -598,14 +598,15 @@ def put(self, request, friendly_token, format=None): media = self.get_object(friendly_token) if isinstance(media, Response): return media - serializer = MediaSerializer(media, data=request.data, context={"request": request}) if serializer.is_valid(): - if request.data.get('media_file'): - media_file = request.data["media_file"] - serializer.save(user=request.user, media_file=media_file) - else: - serializer.save(user=request.user) + serializer.save(user=request.user) + # no need to update the media file itself, only the metadata + #if request.data.get('media_file'): + # media_file = request.data["media_file"] + # serializer.save(user=request.user, media_file=media_file) + #else: + # serializer.save(user=request.user) return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)