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

Develop #772

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

Develop #772

wants to merge 9 commits into from

Conversation

b4oody
Copy link

@b4oody b4oody commented Dec 28, 2024

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.

Great job on your submission! 🎉 The code is mostly compliant with the task requirements, and there are no critical issues affecting functionality. While there are some minor improvements suggested, such as using serializers.ModelSerializer to simplify your serializers and refining the __str__ methods for better readability, these do not impact the core functionality of your application. Keep up the good work, and consider these suggestions for future enhancements! 😊

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

cinema/models.py Outdated
Comment on lines 8 to 9
def __str__(self):
return f"{self.first_name}{self.last_name}"

Choose a reason for hiding this comment

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

The __str__ method for the Actor model should include a space between the first and last names for better readability. Consider changing it to return f"{self.first_name} {self.last_name}".

cinema/models.py Outdated
Comment on lines 35 to 36
def __str__(self):
return self.title
return f"{self.title}:({self.genres}, {self.duration})"

Choose a reason for hiding this comment

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

In the __str__ method of the Movie model, directly including self.genres will not display the genre names as expected. You might want to use a method to join the genre names into a string, such as ', '.join(genre.name for genre in self.genres.all()).

Genre,
Actor,
CinemaHall
)


class MovieSerializer(serializers.Serializer):

Choose a reason for hiding this comment

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

Consider using serializers.ModelSerializer for the MovieSerializer class. This would automatically generate the create and update methods based on the model fields, reducing boilerplate code.

@@ -22,3 +27,48 @@
instance.save()

return instance


class ActorSerializer(serializers.Serializer):

Choose a reason for hiding this comment

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

Consider using serializers.ModelSerializer for the ActorSerializer class to simplify the code by automatically handling the create and update methods.

return instance


class GenreSerializer(serializers.Serializer):

Choose a reason for hiding this comment

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

Consider using serializers.ModelSerializer for the GenreSerializer class to reduce the need for manually defining the create and update methods.

return instance


class CinemaHallSerializer(serializers.Serializer):

Choose a reason for hiding this comment

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

Consider using serializers.ModelSerializer for the CinemaHallSerializer class to automatically handle the create and update methods, simplifying the code.

cinema/views.py Outdated

class GenreList(APIView):
@staticmethod

Choose a reason for hiding this comment

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

The use of @staticmethod for the get and post methods in GenreList is unnecessary. These methods should be instance methods, not static methods, as they rely on the request object.

cinema/views.py Outdated

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
class GenreDetail(APIView):
@staticmethod

Choose a reason for hiding this comment

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

Similarly, the @staticmethod decorator is not needed for the get_object method in GenreDetail. It should be an instance method to maintain consistency with Django's class-based views.

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