Skip to content

Commit

Permalink
Fix validate_seat_and_row error handling, update action comparison in…
Browse files Browse the repository at this point in the history
… views, and add pagination settings
  • Loading branch information
oboliziuk committed Jan 6, 2025
1 parent b9df023 commit 9385d07
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cinema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def validate_seat_and_row(
row: int,
seat: int,
movie_session,
error_to_raise
error_to_raise=ValidationError
):
cinema_hall = movie_session.cinema_hall

Expand Down
1 change: 1 addition & 0 deletions cinema/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def validate(self, attrs):
return data



class TicketDetailSerializer(serializers.ModelSerializer):
movie_session = MovieSessionListSerializer(read_only=True)

Expand Down
2 changes: 1 addition & 1 deletion cinema/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_queryset(self):
if title:
queryset = queryset.filter(title__icontains=title)

if self.action == ("list", "retrieve"):
if self.action == ["list", "retrieve"]:
queryset = Movie.objects.prefetch_related("actors")

return queryset.distinct()
Expand Down
5 changes: 5 additions & 0 deletions cinema_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@

# USE_TZ = False

# REST_FRAMEWORK = {
# "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
# "PAGE_SIZE": 1
# }

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

Expand Down

0 comments on commit 9385d07

Please sign in to comment.