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

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

Conversation

kostomeister
Copy link

No description provided.

db/models.py Outdated
Comment on lines 94 to 102
if not (1 < self.seat < self.movie_session.cinema_hall.seats_in_row):
raise ValidationError(
{
"seat": [f"seat number must be in available range: "
f"(1, seats_in_row): "
f"(1, "
f"{self.movie_session.cinema_hall.seats_in_row})"]
}
)

Choose a reason for hiding this comment

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

You can use a variable "valid_row/seat", it's improve readability of your code.

Comment on lines +74 to +75
class Meta:
ordering = ["-created_at"]

Choose a reason for hiding this comment

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

class Meta should be placed before methods, don't forget to read checklist, please

Choose a reason for hiding this comment

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

fix everywhere

Comment on lines +74 to +75
class Meta:
ordering = ["-created_at"]

Choose a reason for hiding this comment

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

fix everywhere

services/user.py Outdated
Comment on lines 11 to 29
user = User.objects.create_user(
username=username,
password=password
)

if email:
user.email = email

if first_name:
user.first_name = first_name

if last_name:
user.last_name = last_name

user.save()


def get_user(user_id: int) -> User:
return User.objects.get(id=user_id)

Choose a reason for hiding this comment

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

use get_user_model() also here

db/models.py Outdated

class Order(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(to=User, on_delete=models.CASCADE)

Choose a reason for hiding this comment

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

you should refer to AUTH_USER_MODEL

Copy link

@LiudmylaKulinchenko LiudmylaKulinchenko left a comment

Choose a reason for hiding this comment

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

Good job 🚀

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