-
Notifications
You must be signed in to change notification settings - Fork 726
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' #686
base: master
Are you sure you want to change the base?
'Solution' #686
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.
Tests failed
cinema/models.py
Outdated
genres = models.ManyToManyField(Genre) | ||
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
requirements.txt
Outdated
@@ -4,4 +4,4 @@ flake8-quotes==3.3.1 | |||
flake8-variables-names==0.0.5 | |||
pep8-naming==0.13.2 | |||
django-debug-toolbar==3.2.4 | |||
djangorestframework==3.13.1 | |||
djangorestframework==3.13.1 |
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 new empty line
cinema/views.py
Outdated
serializer = GenreSerializer(genre, data=request.data, partial=True) | ||
if serializer.is_valid(): | ||
serializer.save() | ||
return Response(serializer.data) |
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.
Avoid using an if
condition to check if a serializer is valid. Instead, use the raise_exception=True
flag when calling serializer.is_valid()
. This will automatically raise a ValidationError
if the data is invalid, which is then caught by the DRF exception handler to return a 400 Bad Request
response.
@@ -1,4 +1,4 @@ | |||
# Generated by Django 4.0.2 on 2022-05-03 13:41 |
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.
Do not modify existing migration file. Create a new one instead
cinema/models.py
Outdated
class Genre(models.Model): | ||
name = models.CharField(max_length=255, unique=True) | ||
|
||
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 annotation
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 annotation
|
||
def __str__(self): | ||
return self.title |
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.
Any need to change this?
@@ -1,4 +1,4 @@ | |||
# Generated by Django 4.0.2 on 2022-05-03 13:41 |
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.
DO not modify existing migration file. Create a new one instead
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.
this is a new one!
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.
Several changes were requested
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.
Please, make sure that initial migration is left untouched and is not included in the PR
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.
GJ!
No description provided.