Skip to content

Commit

Permalink
Finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksa-32 committed Jan 5, 2025
1 parent 2459d2d commit 035260a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cinema/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from rest_framework import serializers

from cinema.models import Movie, Actor
from cinema.models import Movie, Actor, Genre, CinemaHall


class MovieSerializer(serializers.Serializer):
Expand Down Expand Up @@ -32,7 +32,7 @@ class GenreSerializer(serializers.Serializer):
name = serializers.CharField(max_length=255)

def create(self, validated_data):
return Actor.objects.create(**validated_data)
return Genre.objects.create(**validated_data)

def update(self, instance, validated_data):
instance.name = validated_data.get("name", instance.name)
Expand Down Expand Up @@ -64,7 +64,7 @@ class CinemaHallSerializer(serializers.Serializer):
seats_in_row = serializers.IntegerField()

def create(self, validated_data):
return Movie.objects.create(**validated_data)
return CinemaHall.objects.create(**validated_data)

def update(self, instance, validated_data):
instance.name = validated_data.get("name", instance.name)
Expand Down

0 comments on commit 035260a

Please sign in to comment.