From d5cab4a32250c4082a47cdf580ae58ac1e61b7a2 Mon Sep 17 00:00:00 2001 From: Stepan Date: Wed, 7 Jan 2026 20:09:26 +0100 Subject: [PATCH] Fixed patch method --- publications/serializers.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/publications/serializers.py b/publications/serializers.py index 4a4b7d6..17b373d 100644 --- a/publications/serializers.py +++ b/publications/serializers.py @@ -20,9 +20,18 @@ class PublicationSerializer(serializers.ModelSerializer): return getattr(obj, 'average_score', 0) def validate(self, attrs): - content_type = attrs.get('content_type') - image = attrs.get('image') - video = attrs.get('video') + content_type = attrs.get( + 'content_type', + getattr(self.instance, 'content_type', None) + ) + image = attrs.get( + 'image', + getattr(self.instance, 'image', None) + ) + video = attrs.get( + 'video', + getattr(self.instance, 'video', None) + ) errors = {}