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

API Views #374

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

Conversation

IProskurnytskyi
Copy link

No description provided.

cinema/views.py Outdated
Comment on lines 56 to 57
return Response(serializer.data, status=status.HTTP_200_OK)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

Choose a reason for hiding this comment

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

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.

LGTM, one comment is left for consideration.

movie = get_object_or_404(Movie, pk=pk)
class GenreDetail(APIView):
def get_object(self, pk: int) -> Genre:
return get_object_or_404(Genre, id=pk)

Choose a reason for hiding this comment

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

You could use get_object_or_404 directly in your methods where needed, there is no need to allocate a separate method for that.

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.

3 participants