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

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

Solution #766

wants to merge 2 commits into from

Conversation

zaietsmo
Copy link

No description provided.

cinema/views.py Outdated
Comment on lines 30 to 32
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
Copy link
Contributor

Choose a reason for hiding this comment

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

use serializer.is_valid(raise_exception=True)

Copy link
Contributor

Choose a reason for hiding this comment

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

the same everywhere

cinema/views.py Outdated
Comment on lines 38 to 41
try:
return Genre.objects.get(pk=pk)
except Genre.DoesNotExist:
raise Http404
Copy link
Contributor

Choose a reason for hiding this comment

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

use get_object_or_404(Genre, pk=pk)

@zaietsmo zaietsmo requested a review from Nattalli January 7, 2025 21:20
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.

Imports should be grouped and separated by a blank line according to standard library, external libraries, and custom imports. This practice enhances both code readability and maintainability.

Read more about topic here

The views violate the DRY principle.

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