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 #734

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

Develop #734

wants to merge 5 commits into from

Conversation

b4oody
Copy link

@b4oody b4oody commented Jan 8, 2025

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.

It looks like there are a few critical issues that need to be addressed before we can approve the pull request. The most important ones are:

  1. ImageField Implementation: The ImageField in the Movie model is missing, which is a core requirement of the task. This needs to be implemented to handle image uploads correctly.

  2. AuthTokenSerializer Message: The error message in the validate method should refer to 'email' instead of 'username', as authentication is based on email.

  3. MovieImageSerializer Source: The source parameter in MovieImageSerializer should be corrected to refer to the field movie instead of movie.image.

  4. Upload Path Function: The upload_to parameter in the ImageField should reference the create_custom_path function correctly without quotes, as it is a callable.

  5. Function Definition: Ensure that the create_custom_path function is defined and accessible in your project to avoid runtime errors during image uploads.

Please address these issues to ensure the functionality meets the task requirements. Once these are resolved, your work will be in great shape! 😊 Keep up the good work and don't hesitate to reach out if you need any help.

✨ 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.

Comment on lines +15 to +16
name='image',
field=models.ImageField(null=True, upload_to='create_custom_path'),

Choose a reason for hiding this comment

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

Ensure that the create_custom_path function is defined in your project. This function should return the desired path for storing the uploaded images. If it's not defined, this will cause an error when trying to upload an image.

cinema/models.py Outdated
class Movie(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
duration = models.IntegerField()
genres = models.ManyToManyField(Genre)
actors = models.ManyToManyField(Actor)
image = models.ImageField(upload_to="create_custom_path", null=True)

Choose a reason for hiding this comment

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

The upload_to parameter in the ImageField should reference the create_custom_path function without quotes, as it is a callable. Change upload_to="create_custom_path" to upload_to=create_custom_path.

@@ -69,6 +92,7 @@ class MovieSessionListSerializer(MovieSessionSerializer):
source="cinema_hall.capacity", read_only=True
)
tickets_available = serializers.IntegerField(read_only=True)
movie_image = MovieImageSerializer(source="movie.image", read_only=True)

Choose a reason for hiding this comment

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

The source parameter in MovieImageSerializer should refer to the field movie, not movie.image. Change source="movie.image" to source="movie" to correctly serialize the image field.

Comment on lines +105 to +106
elif self.action == "upload_image":
return MovieImageSerializer

Choose a reason for hiding this comment

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

Ensure that the MovieImageSerializer is correctly handling the image upload. The upload_to parameter in the Movie model's ImageField should reference the create_custom_path function correctly to avoid any issues during image upload.

Comment on lines +136 to +138
MEDIA_ROOT = BASE_DIR / "media"

MEDIA_URL = "/media/"

Choose a reason for hiding this comment

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

The MEDIA_ROOT and MEDIA_URL settings are correctly configured for handling media files. Ensure that the directory specified in MEDIA_ROOT exists and is writable by the web server to avoid issues with file uploads.

migrations.AlterModelManagers(
name="user",
managers=[
("objects", user.models.UserManager()),

Choose a reason for hiding this comment

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

Ensure that the UserManager class is defined in the user.models module and is correctly implemented to handle user creation and management without the username field.

Comment on lines +60 to +61
msg = _('Must include "username" and "password".')
raise serializers.ValidationError(msg, code="authorization")

Choose a reason for hiding this comment

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

The error message in the validate method of AuthTokenSerializer should refer to 'email' instead of 'username', as the authentication is based on email. Change the message to _('Must include "email" and "password".')

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 features! 🎉 While the Pull Request is approved to help you move forward with your learning, there are a few critical issues that need attention:

  1. ImageField in Movie Model: The upload_to parameter should reference the create_custom_path function without quotes, as it is a callable. Please change 'create_custom_path' to create_custom_path.

  2. AuthTokenSerializer Validate Method: The error message in the validate method should refer to "email" instead of "username". Update the message to _('Must include "email" and "password".') to align with the authentication process.

  3. Upload Path Function: Ensure the create_custom_path function is defined to avoid runtime errors during image uploads.

These changes are crucial for the functionality of your code. Keep up the good work and continue improving your skills! 🚀

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

Comment on lines +15 to +16
name='image',
field=models.ImageField(null=True, upload_to='create_custom_path'),

Choose a reason for hiding this comment

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

The upload_to parameter should reference the create_custom_path function without quotes, as it is a callable. Change 'create_custom_path' to create_custom_path.

Comment on lines +60 to +61
msg = _('Must include "username" and "password".')
raise serializers.ValidationError(msg, code="authorization")

Choose a reason for hiding this comment

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

The error message should refer to 'email' instead of 'username'. Change the message to _('Must include "email" and "password".') to align with the authentication process.

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