-
Notifications
You must be signed in to change notification settings - Fork 859
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 #916
base: master
Are you sure you want to change the base?
Solution #916
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.
It looks like there are several best practice issues that need to be addressed, such as using get_user_model()
and organizing the class Meta
correctly. These changes are important for maintaining code quality and ensuring scalability. Keep up the good work, and once these are fixed, your code will be even better! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
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 your submission! 🎉 While there are a few minor issues related to code style and best practices, such as the use of quotes and the get_user_model()
recommendation, the overall structure and functionality of your code are solid. Remember to review the comments to enhance your code quality. 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! ✨
email: str = None, | ||
first_name: str = None, | ||
last_name: str = None) -> User: | ||
user = get_user_model().objects.get(pk=user_id) |
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.
you can use get_user
here
with transaction.atomic(): | ||
|
||
user = get_user_model().objects.get(username=username) | ||
order = Order.objects.create(user=user) | ||
tickets_instances = [] | ||
if date: | ||
order.created_at = date |
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.
Use transaction.atomic as decorator instead of context manager. It will make your code more readable
with transaction.atomic(): | ||
movie = Movie.objects.create( | ||
title=movie_title, | ||
description=movie_description, | ||
) | ||
if genres_ids: | ||
movie.genres.set(genres_ids) | ||
if actors_ids: | ||
movie.actors.set(actors_ids) | ||
|
||
return movie |
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.
Use transaction.atomic as decorator instead of context manager. It will make your code more readable
No description provided.