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

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

Solution #903

wants to merge 2 commits into from

Conversation

SkepskyiDanylo
Copy link

No description provided.

Comment on lines 36 to 44
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)
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