-
Notifications
You must be signed in to change notification settings - Fork 707
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 #725
base: master
Are you sure you want to change the base?
solution #725
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good i guess!
There was a problem hiding this 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! 😊 There are a few critical issues that need to be addressed before we can approve the pull request:
-
Order Creation Issue: In
cinema/serializers.py
, theOrderSerializer
has a critical issue where thecreate
method does not handle the creation of relatedTicket
objects correctly. Thetickets
field is not set to read-only, which can lead to unexpected behavior. Please ensure that the order creation process maintains data integrity by addressing this issue. -
Security Concerns: In
cinema_service/settings.py
, theSECRET_KEY
should be kept secret in production, andDEBUG
should be set toFalse
to avoid exposing sensitive information. These are critical for the security of your application. -
Missing Pagination Configuration: The task requires pagination to be configured in
settings.py
, but it is missing. Please add this configuration to meet the task requirements.
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.
cinema/serializers.py
Outdated
|
||
|
||
class OrderSerializer(serializers.ModelSerializer): | ||
tickets = TicketSerializer(many=True, read_only=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tickets
field in OrderSerializer
is not set to read_only=True
, which can cause issues when creating orders. Consider setting read_only=True
if you do not intend to allow direct creation of tickets through the order serializer.
There was a problem hiding this 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 many of the previous issues! 🎉 However, there are still some critical points that need attention to ensure your code meets all task requirements:
-
Order Creation Issue: The
OrderSerializer
incinema/serializers.py
now handles the creation of relatedTicket
objects using thecreate
method. However, thetickets
field is still set to read-only, which prevents input data for creating tickets. Make sure to adjust this by either removingread_only=True
or implementing a different logic to handle ticket creation. -
Security Concerns: The
SECRET_KEY
is hardcoded incinema_service/settings.py
. While settingDEBUG
toFalse
is correct for production, ensure theSECRET_KEY
is kept secret by using environment variables or a separate configuration file. -
Pagination Configuration: Although the pagination configuration is present through the
OrderPagination
class, ensure it is explicitly mentioned insettings.py
if required by the task.
These issues are important for the functionality and security of your application. Please address them to improve your code. Keep up the good work, and continue learning from these experiences! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
|
||
|
||
class OrderSerializer(serializers.ModelSerializer): | ||
tickets = TicketSerializer(many=True, read_only=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tickets
field is set to read_only=True
, which means it will not be included in the input data for the create
method. This will cause tickets_data
to be empty, and no Ticket
objects will be created. Consider removing read_only=True
or handling ticket creation differently.
|
||
def create(self, validated_data): | ||
with transaction.atomic(): | ||
tickets_data = validated_data.pop("tickets") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since tickets
is read-only, validated_data.pop("tickets")
will not retrieve any ticket data. You need to adjust this logic to correctly handle ticket creation.
No description provided.