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

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

Develop #732

wants to merge 14 commits into from

Conversation

frezworx
Copy link

No description provided.

Switched the `USE_TZ` setting to `True` in `settings.py` to enable proper timezone support. This ensures datetime handling is consistent and adheres to best practices for time zone–aware applications.
Introduced an `ImageField` to the `Movie` model for image uploads, using a custom upload path based on the movie title and UUID. Added tests to verify the path generation logic and updated settings to include `MEDIA_ROOT` and `MEDIA_URL` for media file handling.
Replaced username with email as the unique identifier for users. Implemented a custom UserManager to handle user and superuser creation. Adjusted model configurations to align with the updated authentication flow.
Replaced the basic UserAdmin registration with a custom class extending Django's UserAdmin. Added fieldsets, list display, search fields, and ordering to enhance the user management experience in the admin interface. This improves usability and adheres to best practices.
Introduced `MovieImageSerializer` to handle movie image uploads. Updated views to use the new serializer when the `upload_image` action is triggered. This enhances functionality by allowing image uploads for movies.
Introduced a new POST endpoint `upload-image` to allow admins to upload images to movies. The endpoint includes validation via serializers and appropriate response handling for success or failure. Updated permission classes to restrict access to admin users only.
Replaced username with email as the unique user identifier. Updated serializers, views, and migrations to reflect the changes, including adding a custom `AuthTokenSerializer` for email-based authentication. Improved password field handling for better security and user experience.
Removed `IsAdminUser` restriction on image upload, added `movie_image` to session serializers, and updated settings for static media files. Adjusted permissions to distinguish between staff and superusers for better access control.
Removed `IsAdminUser` restriction on image upload, added `movie_image` to session serializers, and updated settings for static media files. Adjusted permissions to distinguish between staff and superusers for better access control.
Restricted `POST` requests on the movie list endpoint to prevent invalid actions. Added email uniqueness validation to user creation for better error handling. Marked the `image` field in `MovieSerializer` as read-only for consistency.
Adjusted formatting across multiple files for improved readability and compliance with style guidelines. Changes include consistent indentation, line breaking for better clarity, and removal of unnecessary parentheses or multiline constructs.
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.

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

Something went wrong while processing the review.
[CODE: 3]

If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.

Cleaned up extra blank lines at the end of the settings file to adhere to code style guidelines and improve readability. This change has no impact on functionality.
Added new dependencies and updated existing ones to ensure compatibility and consistency. This includes tools for development, testing, and project runtime like Black, Django Debug Toolbar, and Pillow.
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 Pull Request! 😊 While you've made great progress, there are a few critical issues that need to be addressed before we can approve it:

  1. ImageField Requirement: It's essential to ensure that the ImageField is correctly implemented in the Movie model and that images are only uploaded via the /upload-image/ endpoint. Please verify and adjust the implementation as needed.

  2. Image URL Display: Make sure that the image URL is displayed correctly on the movie list and detail pages, as well as on the movie session list and detail pages. This is a core requirement that needs to be fulfilled.

  3. Checklist Compliance: Double-check that serializers.ImageField is used instead of serializers.CharField for images, and ensure code style guidelines are followed, such as having a blank line at the end of all files.

Once these issues are resolved, your code will be in great shape! Keep up the fantastic 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.

model_name="movie",
name="image",
field=models.ImageField(
null=True, upload_to=cinema.models.get_upload_image_path

Choose a reason for hiding this comment

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

Ensure that the get_upload_image_path function in cinema.models is correctly defined to format the image path as required: f"{slugify(movie.title)}-{uuid}{ext}". This is crucial for meeting the task's requirement for image saving format.

Updated MovieSessionDetailSerializer to include a custom method for movies, modifying the returned data structure to include "movie_image". Additionally, adjusted the upload file path in the Movie model for consistency.
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 required features! 🎉 The code meets the task requirements and constraints, with a well-structured implementation of the ImageField in the Movie model, correct usage of serializers.ImageField, and comprehensive test cases. However, please ensure all files end with a blank line to comply with code style guidelines. Additionally, update the error message in the AuthTokenSerializer to refer to 'email' instead of 'username' to align with the custom user model. This decision is made to help you move forward with your learning journey. Keep up the good work and continue improving your code! 🚀

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

Comment on lines +70 to +71
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' to align with the custom user model. Consider updating the message to: _('Must include "email" and "password".')

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