Skip to content

Commit

Permalink
add read_only_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitrySamoylenko committed Dec 7, 2024
1 parent 0c83e63 commit 2820a0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cinema/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",)

0 comments on commit 2820a0b

Please sign in to comment.