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

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

solution #734

wants to merge 5 commits into from

Conversation

OlhaStadnik
Copy link

No description provided.

Copy link

@spa7id spa7id left a comment

Choose a reason for hiding this comment

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

LGTM

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 your code is mostly well-structured and aligns with best practices, there are a couple of critical issues that need to be addressed before we can approve the pull request:

  1. Ticket Model Validation: In the models.py file, the Ticket model's clean method is using incorrect attribute names (count_rows and count_seats_in_row) for validation. These should be corrected to rows and seats_in_row to avoid AttributeError during validation.

  2. MovieListSerializer Issue: In the serializers.py file, the MovieListSerializer is using SlugRelatedField with slug_field='full_name'. Since full_name is a property and not a model field, this will cause an error. Consider using a SerializerMethodField to properly serialize the full name.

Once these issues are resolved, your code will be in great shape! Keep up the good work, and feel free to reach out if you have any questions or need further assistance. 🚀

✨ 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 +28 to +29
actors = serializers.SlugRelatedField(
many=True, read_only=True, slug_field="full_name"

Choose a reason for hiding this comment

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

The actors field in MovieListSerializer uses SlugRelatedField with slug_field='full_name'. However, full_name is a property, not a model field, which will cause an error. Consider using a SerializerMethodField to serialize the full name instead.

cinema/urls.py Outdated
# write urls here
from django.urls import path, include
from rest_framework import routers
from rest_framework.urls import app_name

Choose a reason for hiding this comment

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

The import app_name from rest_framework.urls is not used in this file. Consider removing it to clean up the code.

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 addressing the issues in your code! 🎉 Your solution now meets the task requirements, and all necessary components are implemented correctly. However, there are a few points to consider for future improvements:

  1. Ticket Model Validation: You've successfully corrected the attribute names in the clean method of the Ticket model. This change will prevent AttributeError during validation. Keep up the good work!

  2. MovieListSerializer: The use of SlugRelatedField with slug_field='full_name' for the actors field is incorrect since full_name is a property, not a model field. Consider using a SerializerMethodField to properly serialize the actor's full name. This will ensure that your serialization logic aligns with the model structure.

  3. URL Configuration: Your urls.py files are well-configured, and no changes are needed. It's great to see that you have set up the URL routing correctly using Django REST Framework's router.

  4. Viewsets and Serializers: Your views.py file is well-structured, with appropriate use of viewsets and serializer classes. The dynamic switching between serializers based on actions is implemented correctly.

Remember, the decision to approve is to help you move forward with your learning. Please review the comments to improve your code further. Addressing critical issues like the SerializerMethodField will enhance your understanding and prevent similar problems in the future. 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 +28 to +30
actors = serializers.SlugRelatedField(
many=True, read_only=True, slug_field="full_name"
)

Choose a reason for hiding this comment

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

The SlugRelatedField with slug_field='full_name' is incorrect because full_name is a property, not a model field. Use a SerializerMethodField to serialize the actor's full name.

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.

3 participants