From 76bbb211404b3d8e33bb780d91932aaf66765063 Mon Sep 17 00:00:00 2001 From: Vladyslav Kucherenko Date: Sun, 8 Dec 2024 16:21:15 +0200 Subject: [PATCH] simplified solution --- cinema/serializers.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cinema/serializers.py b/cinema/serializers.py index a00ba3e6..0290fee8 100644 --- a/cinema/serializers.py +++ b/cinema/serializers.py @@ -43,10 +43,7 @@ class MovieListSerializer(MovieSerializer): read_only=True, slug_field="name" ) - actors = serializers.SerializerMethodField() - - def get_actors(self, obj: Movie) -> list[str]: - return [str(actor) for actor in obj.actors.all()] + actors = serializers.StringRelatedField(many=True) class MovieSessionSerializer(serializers.ModelSerializer):