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

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

Solution #692

wants to merge 6 commits into from

Conversation

Ivan-Shakhman
Copy link

Solution of this task

cinema/models.py Outdated
Comment on lines 23 to 24
actors = models.ManyToManyField(Actor)
genres = models.ManyToManyField(Genre)
Copy link

Choose a reason for hiding this comment

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

it's better to always add related name

cinema/urls.py Outdated
Comment on lines 1 to 2
from django.urls import path, include
from rest_framework import routers
Copy link

Choose a reason for hiding this comment

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

split different groups of imports

Comment on lines +23 to +24
actors = models.ManyToManyField(Actor, related_name="movies")
genres = models.ManyToManyField(Genre, related_name="movies")
Copy link

Choose a reason for hiding this comment

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

where is your migration? :)

cinema/views.py Outdated
Comment on lines 35 to 37
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(
Copy link

Choose a reason for hiding this comment

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

it's better to use
serializer.is_valid(raise_exception=True)
Fix everywhere

@Ivan-Shakhman Ivan-Shakhman requested a review from MNDonut October 2, 2024 08:26
Copy link

@LiudmylaKulinchenko LiudmylaKulinchenko left a comment

Choose a reason for hiding this comment

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

Looks good! 💐

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.

4 participants