From 8e3d0683447f9a31e3c1307a6293310c24ded6d2 Mon Sep 17 00:00:00 2001 From: dmytro Date: Sat, 7 Dec 2024 20:32:52 +0200 Subject: [PATCH 1/4] solution --- cinema/admin.py | 12 ++++- cinema/models.py | 4 ++ cinema/serializers.py | 108 ++++++++++++++++++++++++++++++++++++- cinema/urls.py | 25 ++++++++- cinema/views.py | 58 +++++++++++++++++++- cinema_service/settings.py | 6 +++ cinema_service/urls.py | 4 +- 7 files changed, 212 insertions(+), 5 deletions(-) diff --git a/cinema/admin.py b/cinema/admin.py index 0b288331..38bb0138 100644 --- a/cinema/admin.py +++ b/cinema/admin.py @@ -10,10 +10,20 @@ Ticket, ) + +class TicketInLine(admin.TabularInline): + model = Ticket + extra = 1 + + +@admin.register(Order) +class OrderAdmin(admin.ModelAdmin): + inlines = (TicketInLine,) + + admin.site.register(CinemaHall) admin.site.register(Genre) admin.site.register(Actor) admin.site.register(Movie) admin.site.register(MovieSession) -admin.site.register(Order) admin.site.register(Ticket) diff --git a/cinema/models.py b/cinema/models.py index c42d2a3d..3fe16827 100644 --- a/cinema/models.py +++ b/cinema/models.py @@ -27,6 +27,10 @@ class Actor(models.Model): first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) + @property + def full_name(self) -> str: + return f"{self.first_name} {self.last_name}" + def __str__(self): return self.first_name + " " + self.last_name diff --git a/cinema/serializers.py b/cinema/serializers.py index 612ca7e2..3f1ca2ef 100644 --- a/cinema/serializers.py +++ b/cinema/serializers.py @@ -1 +1,107 @@ -# write serializers here +from rest_framework import serializers + +from cinema.models import ( + Movie, + MovieSession, + Genre, + CinemaHall, + Actor +) + + +class ActorSerializer(serializers.ModelSerializer): + + class Meta: + model = Actor + fields = ("id", "first_name", "last_name", "full_name") + read_only_fields = ("id",) + + +class CinemaHallSerializer(serializers.ModelSerializer): + + class Meta: + model = CinemaHall + fields = ("id", "name", "rows", "seats_in_row", "capacity") + read_only_fields = ("id",) + + +class GenreSerializer(serializers.ModelSerializer): + + class Meta: + model = Genre + fields = ("id", "name") + read_only_fields = ("id",) + + +class MovieSerializer(serializers.ModelSerializer): + + class Meta: + model = Movie + fields = ("id", "title", "description", "duration", "genres", "actors") + read_only_fields = ("id",) + + +class MovieListSerializer(MovieSerializer): + + genres = serializers.SlugRelatedField( + many=True, + read_only=True, + slug_field="name" + ) + actors = serializers.SlugRelatedField( + many=True, + read_only=True, + slug_field="full_name" + ) + + +class MovieRetrieveSerializer(MovieSerializer): + + genres = GenreSerializer(many=True) + actors = ActorSerializer(many=True) + + +class MovieSessionSerializer(serializers.ModelSerializer): + class Meta: + model = MovieSession + fields = ("id", "show_time", "movie", "cinema_hall") + + +class MovieSessionListSerializer(MovieSessionSerializer): + + movie_title = serializers.CharField( + source="movie.title", + read_only=True + ) + cinema_hall_name = serializers.CharField( + source="cinema_hall.name", + read_only=True + ) + 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" + ) + read_only_fields = ("id",) + + +class MovieSessionRetrieveSerializer( + MovieSessionSerializer +): + + cinema_hall = CinemaHallSerializer(read_only=True) + movie = MovieListSerializer() + + class Meta: + model = MovieSession + fields = ("id", "show_time", "movie", "cinema_hall") + read_only_fields = ("id",) diff --git a/cinema/urls.py b/cinema/urls.py index 420f8e8c..fd56de1f 100644 --- a/cinema/urls.py +++ b/cinema/urls.py @@ -1 +1,24 @@ -# write urls here +from django.urls import path, include +from rest_framework import routers + +from cinema.views import ( + MovieViewSet, + MovieSessionViewSet, + GenreViewSet, + ActorViewSet, + CinemaHallViewSet +) + + +router = routers.DefaultRouter() +router.register("actors", ActorViewSet) +router.register("genres", GenreViewSet) +router.register("cinema_halls", CinemaHallViewSet) +router.register("movies", MovieViewSet) +router.register("movie_sessions", MovieSessionViewSet) + +urlpatterns = [ + path("", include(router.urls)) +] + +app_name = "cinema" diff --git a/cinema/views.py b/cinema/views.py index ae87bfde..f633046b 100644 --- a/cinema/views.py +++ b/cinema/views.py @@ -1 +1,57 @@ -# write views here +from rest_framework import viewsets + +from cinema.serializers import ( + MovieSerializer, + MovieListSerializer, + MovieRetrieveSerializer, + MovieSessionSerializer, + MovieSessionListSerializer, + MovieSessionRetrieveSerializer, + ActorSerializer, + GenreSerializer, + CinemaHallSerializer +) +from cinema.models import ( + Movie, + MovieSession, + Actor, + Genre, + CinemaHall +) + + +class MovieViewSet(viewsets.ModelViewSet): + queryset = Movie.objects.prefetch_related("genres", "actors") + + def get_serializer_class(self): + if self.action == "list": + return MovieListSerializer + if self.action == "retrieve": + return MovieRetrieveSerializer + return MovieSerializer + + +class MovieSessionViewSet(viewsets.ModelViewSet): + queryset = MovieSession.objects.select_related("cinema_hall", "movie") + + def get_serializer_class(self): + if self.action == "list": + return MovieSessionListSerializer + if self.action == "retrieve": + return MovieSessionRetrieveSerializer + return MovieSessionSerializer + + +class ActorViewSet(viewsets.ModelViewSet): + queryset = Actor.objects.all() + serializer_class = ActorSerializer + + +class GenreViewSet(viewsets.ModelViewSet): + queryset = Genre.objects.all() + serializer_class = GenreSerializer + + +class CinemaHallViewSet(viewsets.ModelViewSet): + queryset = CinemaHall.objects.all() + serializer_class = CinemaHallSerializer diff --git a/cinema_service/settings.py b/cinema_service/settings.py index 4b981921..6a3a572a 100644 --- a/cinema_service/settings.py +++ b/cinema_service/settings.py @@ -40,12 +40,14 @@ "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", + "debug_toolbar", "cinema", "user", ] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", + "debug_toolbar.middleware.DebugToolbarMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", @@ -131,3 +133,7 @@ # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" + +INTERNAL_IPS = [ + "127.0.0.1", +] diff --git a/cinema_service/urls.py b/cinema_service/urls.py index 083932c6..109f5f11 100644 --- a/cinema_service/urls.py +++ b/cinema_service/urls.py @@ -1,6 +1,8 @@ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ path("admin/", admin.site.urls), + path("api/cinema/", include("cinema.urls", namespace="cinema")), + path("__debug__/", include("debug_toolbar.urls")) ] From a2e4feb6314de71dbb352bfddac89599a2251d15 Mon Sep 17 00:00:00 2001 From: dmytro Date: Sat, 7 Dec 2024 20:34:45 +0200 Subject: [PATCH 2/4] solution --- db.sqlite3 | Bin 0 -> 225280 bytes requirements.txt | 9 ++++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db.sqlite3 diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..26c1c3f3c36b100ea611527db959ae37008b7def GIT binary patch literal 225280 zcmeI53ve9CdEa+-W?#VWHb4@$$0r6Lao`>ZVBZfa^c@H;NsxGuAV40^QEg^-XMrL1 z0nQEp@)SF@xRb0>Do>|m*%e#mDoJ)Zk}bJp$90w>C9)-1i7e}6JCdTDWJS`YEK89T zM@q>`Rle?--I-l19tTs@@$~KSdS|-7{`%j)>FL?-Y0TWXKCNi7SgfjLNfV>C9vjEm zo)$%$%{C7IC*l9b=NZ@#8awdKS+=*^9Jh_F|5FE~+R68+&6DKs$oIQu+`Mbi`3}#J zS9W~2`?K!v2p774jX%KsfsGk$=j_47*PlA-3apHB^_o&C$oJN2vYKVVl3HC`t?AoJ zAvBP_9+Jp*$Wfrr!&@~ z+g(r*P`;>CG}Xs(>H z1R2dt^O=j8`ONHO=7yzAqlln*fu_zgMN_j=3sV!*)3=St%mr|3)(j3y2T4}%(werM zH8bq3jNs<@VOL;ulzXAKjjY}_OrH9F?{*aRynyZmekYXNGjNDU(iNMQccU2s?h8P#e$^Cno^co zgM~DumaVNpo1ogDZC0x#Yfc(lk;<~gcRXbJHqLNxQ&dzaV+YfQjGay7vZR#E!XojQ zS(qVKlZw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Cp8NM+NWc#gKmter2_OL^fCP{L5z|J#l6KP==o<^lBaKfL;H>-e8O|F4HA^!|U1e3!gJ{yR}%1;D4s`{3Pwzfayp zeuex?@{h?|b`^;RNB{{S0VIF~kN^@u0!RP}AOR$R1dxEu=5cWFfqU>hZik0%@kEbu z3xeO+atJ6OWzWlb|;uY1|ID6G6h~R zws@X5N*CoETR3-W35$K=E0-Q@Sk`|!{q0VIF~kN^@u z0!RP}AOR$R1dsp{KmremfJ=Z01HtLlzdhahx4Vmd!^mI%cDnU%!NtB|{lES#IP`Bj z{2>6$Bk(-?vfBlrIsX5Ujr@rGfP4?00Pqd+74k(`0r02fljJ{<4?UzBVlhYn2_OL^ zfCP{L5E(Cf|W40DhjlOkN@{!czc0PCmL#(HM;ckN^@u0!RP}AOR$R1dsp{ zKmter2|N@6bTsc|qkj(@{kz%dAN~x0#-jL|>c=6M?0E#v==>;GZ( zKm1_;evkkXKmter2_OL^fCP{L5_H zzuj2>Pu~Z?9ywsF{}*um|HC<4SPBwA0!RP}AOR$R1dsp{Kmter2_S(7Nr2tge~|0{ zKMyPZzXN{-@DltLz{{}y|D)u^2dNi*ApsoZL97;8;nj+K zh8by+N|O}O1YSj@0=6{sDwN24sWK>7R#dqlF0EBWX+u)L<7mT+SW;GG@k&*OsEy^S z2#&>qbiYy2EjottrD{!PMU+7Iu$a3~ONRO{i8(31LR}5l#NwK^1|>5L#VSCk)!-jM z(v)gtY@;5uJ8k`&=j>CJyu3=|Ccvd47nz2dCQGH7n6IjlZ2zY2=bW~oP0qdmSTD${lB&stiHf*ZDadNR3XVbPswhD|365Dw z24_s+YPF=~fxf261dsp{Kmter2_OL^fCP{L z5 Date: Sat, 7 Dec 2024 20:36:42 +0200 Subject: [PATCH 3/4] solution --- cinema_service/settings.py | 6 ------ requirements.txt | 1 - 2 files changed, 7 deletions(-) diff --git a/cinema_service/settings.py b/cinema_service/settings.py index 6a3a572a..4b981921 100644 --- a/cinema_service/settings.py +++ b/cinema_service/settings.py @@ -40,14 +40,12 @@ "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", - "debug_toolbar", "cinema", "user", ] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", - "debug_toolbar.middleware.DebugToolbarMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", @@ -133,7 +131,3 @@ # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" - -INTERNAL_IPS = [ - "127.0.0.1", -] diff --git a/requirements.txt b/requirements.txt index a0bad245..646a2aae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ asgiref==3.8.1 Django==4.0.4 -django-debug-toolbar==4.4.6 djangorestframework==3.13.1 flake8==5.0.4 flake8-quotes==3.3.1 From 9d6074d3bbadc90a829ccd837457df37ecce0ab2 Mon Sep 17 00:00:00 2001 From: dmytro Date: Sat, 7 Dec 2024 20:38:50 +0200 Subject: [PATCH 4/4] solution --- cinema_service/urls.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cinema_service/urls.py b/cinema_service/urls.py index 109f5f11..e126f35c 100644 --- a/cinema_service/urls.py +++ b/cinema_service/urls.py @@ -3,6 +3,5 @@ urlpatterns = [ path("admin/", admin.site.urls), - path("api/cinema/", include("cinema.urls", namespace="cinema")), - path("__debug__/", include("debug_toolbar.urls")) + path("api/cinema/", include("cinema.urls", namespace="cinema")) ]