diff --git a/cinema/models.py b/cinema/models.py index 7724fd64..56922020 100644 --- a/cinema/models.py +++ b/cinema/models.py @@ -89,14 +89,16 @@ def clean(self): (self.row, "row", "count_rows"), (self.seat, "seat", "count_seats_in_row"), ]: - count_attrs = getattr(self.movie_session.cinema_hall, cinema_hall_attr_name) + count_attrs = getattr( + self.movie_session.cinema_hall, cinema_hall_attr_name + ) if not (1 <= ticket_attr_value <= count_attrs): raise ValidationError( { ticket_attr_name: f"{ticket_attr_name} number " - f"must be in available range: " - f"(1, {cinema_hall_attr_name}): " - f"(1, {count_attrs})" + f"must be in available range: " + f"(1, {cinema_hall_attr_name}): " + f"(1, {count_attrs})" } ) diff --git a/cinema/serializers.py b/cinema/serializers.py index 8923dc4e..a929eab6 100644 --- a/cinema/serializers.py +++ b/cinema/serializers.py @@ -46,7 +46,10 @@ class MovieDetailSerializer(MovieSerializer): class MovieSessionSerializer(serializers.ModelSerializer): movie = serializers.PrimaryKeyRelatedField(queryset=Movie.objects.all()) - cinema_hall = serializers.PrimaryKeyRelatedField(queryset=CinemaHall.objects.all()) + cinema_hall = (serializers. + PrimaryKeyRelatedField + (queryset=CinemaHall.objects.all())) + class Meta: model = MovieSession fields = ("show_time", "movie", "cinema_hall") diff --git a/cinema/urls.py b/cinema/urls.py index 581af4f2..f37fdd7b 100644 --- a/cinema/urls.py +++ b/cinema/urls.py @@ -14,10 +14,14 @@ router.register("genres", GenreViewSet) router.register("actors", ActorViewSet) router.register("movies", MovieViewSet, basename="movie") -router.register("movie_sessions", MovieSessionViewSet, basename="movie_session") +router.register( + "movie_sessions", + MovieSessionViewSet, + basename="movie_session" +) urlpatterns = [ path("", include(router.urls)) ] -app_name = "cinema" \ No newline at end of file +app_name = "cinema"