Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhii-Chubur committed Jan 7, 2025
1 parent 9e3319a commit 54028e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 0 additions & 2 deletions cinema/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
admin.site.register(MovieSession)


# admin.site.register(Order)
# admin.site.register(Ticket)
class TicketInline(admin.TabularInline):
model = Ticket
extra = 1
Expand Down
13 changes: 9 additions & 4 deletions cinema/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_full_name(self, obj):

class Meta:
model = Actor
fields = "id", "first_name", "last_name", "full_name"
fields = ("id", "first_name", "last_name", "full_name")


class CinemaHallSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -53,9 +53,7 @@ class Meta:
fields = "__all__"


class MovieSessionListSerializer(serializers.Serializer):
movie_session_id = serializers.IntegerField(source="id", read_only=True)
show_time = serializers.CharField(read_only=True)
class MovieSessionListSerializer(serializers.ModelSerializer):
movie_title = serializers.CharField(
source="movie.title", read_only=True
)
Expand All @@ -65,6 +63,13 @@ class MovieSessionListSerializer(serializers.Serializer):
cinema_hall_capacity = serializers.IntegerField(
source="cinema_hall.capacity", read_only=True
)
class Meta:
model = MovieSession
fields = ("id",
"show_time",
"movie_title",
"cinema_hall_name",
"cinema_hall_capacity")


class MovieSessionRetrieveSerializer(MovieSessionSerializer):
Expand Down

0 comments on commit 54028e0

Please sign in to comment.