-
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 #379
base: master
Are you sure you want to change the base?
Solution #379
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.
fix tests
cinema/models.py
Outdated
class Movie(models.Model): | ||
title = models.CharField(max_length=255) | ||
description = models.TextField() | ||
actors = models.ManyToManyField(Actor) |
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.
add related name
cinema/models.py
Outdated
class Movie(models.Model): | ||
title = models.CharField(max_length=255) | ||
description = models.TextField() | ||
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.
add related name
cinema/views.py
Outdated
def patch(self, request, *args, **kwargs): | ||
actor = self.get_object() | ||
serializer = ActorSerializer(actor, data=request.data, partial=True) | ||
if serializer.is_valid(): |
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 serializer.is_valid(raise_exception=True)
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.
I fixed the bugs, ran git add . and ran git push origin develop
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 pushed nothing
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.
did you do a commit like here?https://github.com/mate-academy/py-task-guideline/blob/main/README.md#implement-the-solution
cinema/views.py
Outdated
if serializer.is_valid(): | ||
def post(self, request): | ||
serializer = GenreSerializer(data=request.data) | ||
if serializer.is_valid(raise_exception=True): |
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.
if serializer.is_valid(raise_exception=True): | |
serializer.is_valid(raise_exception=True): |
redundant if statement
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.
fix in all places
cinema/urls.py
Outdated
|
||
urlpatterns = [ | ||
path("movies/", movie_list, name="movie-list"), | ||
path("movies/<int:pk>/", movie_detail, name="movie-detail"), | ||
path("", include(router.urls)), |
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.
BTW, no need to include when basepath not provided. Use: urlpatterns = [list of urls] + router.urls
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.
fix tests
cinema/models.py
Outdated
first_name = models.CharField(max_length=255) | ||
last_name = models.CharField(max_length=255) | ||
|
||
def __str__(self): |
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.
add return annotations throughout the code
No description provided.