Fixed patch method

This commit is contained in:
Stepan 2026-01-07 20:09:26 +01:00
parent 280da6a1a4
commit d5cab4a322

View File

@ -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 = {}