-
Notifications
You must be signed in to change notification settings - Fork 722
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
base: master
Are you sure you want to change the base?
Solution #692
Conversation
cinema/models.py
Outdated
actors = models.ManyToManyField(Actor) | ||
genres = models.ManyToManyField(Genre) |
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's better to always add related name
cinema/urls.py
Outdated
from django.urls import path, include | ||
from rest_framework import routers |
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.
split different groups of imports
actors = models.ManyToManyField(Actor, related_name="movies") | ||
genres = models.ManyToManyField(Genre, related_name="movies") |
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.
where is your migration? :)
cinema/views.py
Outdated
if serializer.is_valid(): | ||
serializer.save() | ||
return Response(serializer.data, status=status.HTTP_201_CREATED) | ||
return Response( |
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's better to use
serializer.is_valid(raise_exception=True)
Fix everywhere
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! 💐
Solution of this task