Skip to content

Commit

Permalink
simplified solution
Browse files Browse the repository at this point in the history
  • Loading branch information
KKvladys committed Dec 8, 2024
1 parent de5b28c commit 76bbb21
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions cinema/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 76bbb21

Please sign in to comment.