From 3235d004611f2331b64ee36d60c0ee74da92196d Mon Sep 17 00:00:00 2001 From: DMYTRO YURCHYSHYN Date: Wed, 11 Dec 2024 18:25:28 +0200 Subject: [PATCH] Optimize the MovieSession queryset --- cinema/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cinema/views.py b/cinema/views.py index 2280f35b..8fed29ef 100644 --- a/cinema/views.py +++ b/cinema/views.py @@ -50,7 +50,9 @@ def get_serializer_class(self): class MovieSessionViewSet(viewsets.ModelViewSet): - queryset = MovieSession.objects + queryset = MovieSession.objects.select_related( + "movie", "cinema_hall" + ) def get_serializer_class(self): if self.action == "list":