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

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

Solution #675

wants to merge 2 commits into from

Conversation

mihavryliuk
Copy link

No description provided.

cinema/models.py Outdated
@@ -1,10 +1,36 @@
from django.db import models


class Actor(models.Model):
first_name = models.CharField(max_length=50)

Choose a reason for hiding this comment

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

suggest you choose value 2^n - 1 for max_length

cinema/urls.py Outdated

urlpatterns = [
path("movies/", movie_list, name="movie-list"),
path("movies/<int:pk>/", movie_detail, name="movie-detail"),

Choose a reason for hiding this comment

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

Delete empty line

cinema/views.py Outdated

from django.shortcuts import get_object_or_404
from rest_framework.views import APIView

Choose a reason for hiding this comment

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

Put this import to other rest_framework imports

cinema/views.py Outdated
movies = Movie.objects.all()
serializer = MovieSerializer(movies, many=True)
class GenreList(APIView):
def get(self, request) -> Response:

Choose a reason for hiding this comment

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

Fix the annotation for request, check everywhere

Copy link

@Arsen-hrynevych Arsen-hrynevych left a comment

Choose a reason for hiding this comment

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

Ok

Comment on lines +83 to +93
def get(self, request, *args, **kwargs) -> Response:
return self.retrieve(request, *args, **kwargs)

def put(self, request, *args, **kwargs) -> Response:
return self.update(request, *args, **kwargs)

def patch(self, request, *args, **kwargs) -> Response:
return self.partial_update(request, *args, **kwargs)

def delete(self, request, *args, **kwargs) -> Response:
return self.destroy(request, *args, **kwargs)

Choose a reason for hiding this comment

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

These methods have already been defined inside your classes

Comment on lines +67 to +71
def get(self, request, *args, **kwargs) -> Response:
return self.list(request, *args, **kwargs)

def post(self, request, *args, **kwargs) -> Response:
return self.create(request, *args, **kwargs)

Choose a reason for hiding this comment

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

These methods have already been defined inside your classes

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