Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #715

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

arsen-arutiunov
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your hard work on this project! 😊 While most of your code aligns well with the task requirements, there's a critical issue with the CinemaHallList and CinemaHallDetail views. They are currently using GenericViewSet, which doesn't match the URL patterns defined in urls.py. This could lead to functionality issues. Please consider using generics.ListCreateAPIView for CinemaHallList and generics.RetrieveUpdateDestroyAPIView for CinemaHallDetail to ensure proper functionality. Once this is addressed, your code will be in great shape! Keep up the great work! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

cinema/urls.py Outdated
Comment on lines 36 to 46
path("cinema-halls/", CinemaHallList.as_view(
actions={"get": "list", "post": "create"}
), name="cinema-hall-list"),
path("cinema-halls/<int:pk>/",
CinemaHallDetail.as_view(
actions={"get": "retrieve",
"put": "update",
"patch": "partial_update",
"delete": "destroy"}
),
name="cinema-hall-detail"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CinemaHallList and CinemaHallDetail views are being used with as_view() and actions, which is typically for viewsets. Ensure these views are indeed viewsets or adjust the implementation to use ListCreateAPIView and RetrieveUpdateDestroyAPIView if they are class-based views.

cinema/views.py Outdated
Comment on lines 97 to 113
class CinemaHallList(
viewsets.GenericViewSet,
mixins.ListModelMixin,
mixins.CreateModelMixin,
):
queryset = CinemaHall.objects.all()
serializer_class = CinemaHallSerializer


class CinemaHallDetail(
viewsets.GenericViewSet,
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
mixins.DestroyModelMixin,
):
queryset = CinemaHall.objects.all()
serializer_class = CinemaHallSerializer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CinemaHallList and CinemaHallDetail classes are using viewsets.GenericViewSet with mixins, which is not appropriate for the URL patterns defined in urls.py. Consider using generics.ListCreateAPIView for CinemaHallList and generics.RetrieveUpdateDestroyAPIView for CinemaHallDetail to match the URL configuration.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on implementing the cinema application! 🎬 Your code meets most of the task requirements and constraints, and it's clear you've put a lot of effort into it. Here are some points to consider for improvement:

  1. Missing related_name for ManyToManyField: In your Movie model, consider adding a related_name for the ManyToManyField fields actors and genres. This will enhance the clarity and usability of your code.

  2. Unnecessary Files: The migration file 0002_actor_cinemahall_genre_movie_actors_movie_genres.py is not directly related to the task requirements. While migrations are essential for database schema changes, they are not part of the task requirements as described.

  3. Meta Class in MovieSerializer: The Meta class is misplaced in MovieSerializer. Since you're using serializers.Serializer, the Meta class is not applicable. Consider removing it or switching to serializers.ModelSerializer if you intend to use it.

These issues are not critical, but addressing them will help you improve your code quality and align with best practices. Keep up the great work, and continue learning from these experiences! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +69 to +76
class Meta:
model = Movie
fields = ["id",
"title",
"description",
"duration",
"actors",
"genres"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Meta class in MovieSerializer is misplaced. Since MovieSerializer is using serializers.Serializer instead of serializers.ModelSerializer, the Meta class is not applicable here. Consider removing the Meta class or switching to serializers.ModelSerializer if you intend to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants