-
Notifications
You must be signed in to change notification settings - Fork 738
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
base: master
Are you sure you want to change the base?
Solution #675
Conversation
cinema/models.py
Outdated
@@ -1,10 +1,36 @@ | |||
from django.db import models | |||
|
|||
|
|||
class Actor(models.Model): | |||
first_name = models.CharField(max_length=50) |
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.
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"), | ||
|
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.
Delete empty line
cinema/views.py
Outdated
|
||
from django.shortcuts import get_object_or_404 | ||
from rest_framework.views import APIView |
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.
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: |
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 the annotation for request
, check 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.
Ok
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) |
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.
These methods have already been defined inside your classes
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) |
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.
These methods have already been defined inside your classes
No description provided.