-
Notifications
You must be signed in to change notification settings - Fork 722
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 #689
base: master
Are you sure you want to change the base?
Solution #689
Conversation
class CinemaHall(models.Model): | ||
name = models.CharField(max_length=255) | ||
rows = models.IntegerField() | ||
seats_in_row = models.IntegerField() |
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.
You can use models.PositiveIntegerField() for rows and seats :)
cinema/serializers.py
Outdated
actors = serializers.PrimaryKeyRelatedField( | ||
many=True, | ||
queryset=Actor.objects.all() | ||
) | ||
genres = serializers.PrimaryKeyRelatedField( | ||
many=True, | ||
queryset=Genre.objects.all() | ||
) | ||
duration = serializers.IntegerField() |
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.
cinema/urls.py
Outdated
from django.urls import path, include | ||
from rest_framework import routers |
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.
split different groups of imports
cinema/views.py
Outdated
if serializer.is_valid(): | ||
serializer.save() |
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.
it's better to use
serializer.is_valid(raise_exception=True)
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 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.
Good job 🌼
No description provided.