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

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

Solution #916

wants to merge 4 commits into from

Conversation

Serhii-Chubur
Copy link

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

db/models.py Show resolved Hide resolved
db/models.py Outdated Show resolved Hide resolved
services/order.py Outdated Show resolved Hide resolved
services/order.py Outdated Show resolved Hide resolved
services/order.py Outdated Show resolved Hide resolved
services/order.py Outdated Show resolved Hide resolved
services/user.py Outdated Show resolved Hide resolved
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 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! ✨

db/models.py Show resolved Hide resolved
db/models.py Show resolved Hide resolved
db/models.py Show resolved Hide resolved
services/movie.py Show resolved Hide resolved
services/movie_session.py Show resolved Hide resolved
services/order.py Show resolved Hide resolved
services/user.py Show resolved Hide resolved
email: str = None,
first_name: str = None,
last_name: str = None) -> User:
user = get_user_model().objects.get(pk=user_id)
Copy link

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

Comment on lines +10 to +16
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
Copy link

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

Comment on lines +36 to +46
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
Copy link

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

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