From 2820a0b3c79a90eb68cb3920e184ec98cfdd2003 Mon Sep 17 00:00:00 2001 From: dmytro Date: Sat, 7 Dec 2024 14:41:39 +0200 Subject: [PATCH] add read_only_fields --- cinema/serializers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cinema/serializers.py b/cinema/serializers.py index 070971ea5..912ea0a4f 100644 --- a/cinema/serializers.py +++ b/cinema/serializers.py @@ -12,21 +12,25 @@ class MovieSerializer(serializers.ModelSerializer): class Meta: model = Movie fields = ("id", "title", "description", "duration") + read_only_fields = ("id",) class GenreSerializer(serializers.ModelSerializer): class Meta: model = Genre fields = ("id", "name") + read_only_fields = ("id",) class CinemaHallSerializer(serializers.ModelSerializer): class Meta: model = CinemaHall fields = ("id", "name", "rows", "seats_in_row") + read_only_fields = ("id",) class ActorSerializer(serializers.ModelSerializer): class Meta: model = Actor fields = ("id", "first_name", "last_name") + read_only_fields = ("id",)