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' #686

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

Conversation

TsvetanKichuk
Copy link

No description provided.

Copy link

@pavlopro pavlopro left a 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
Comment on lines 23 to 24
genres = models.ManyToManyField(Genre)
actors = models.ManyToManyField(Actor)
Copy link

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
Copy link

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
Comment on lines 48 to 51
serializer = GenreSerializer(genre, data=request.data, partial=True)
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
Copy link

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

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):

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):

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

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

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

Copy link
Author

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!

Copy link

@Dimosphen1 Dimosphen1 left a 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

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

Copy link

@pavlopro pavlopro left a comment

Choose a reason for hiding this comment

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

GJ!

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.

None yet

4 participants