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

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

Solution #850

wants to merge 3 commits into from

Conversation

dartomOOv
Copy link

No description provided.

Comment on lines 48 to 49
session = MovieSession.objects.get(id=movie_session_id)
taken_seats = session.ticket_set.values("row", "seat")

Choose a reason for hiding this comment

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

You can make it in one request: filter tickets by movie_session_id

date: str = None,
) -> None:

the_user = get_user_model().objects.get(username=username)

Choose a reason for hiding this comment

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

The prefix the_ is not necessary. Simply using user would be more conventional and clear

Choose a reason for hiding this comment

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

if you want to make it more clear, you can use order_date instead of date


the_user = get_user_model().objects.get(username=username)
with transaction.atomic():
the_order = Order.objects.create(

Choose a reason for hiding this comment

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

same for order

settings.py Outdated

Choose a reason for hiding this comment

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

You don't need to commit this, add to .gitignor

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

services/user.py Outdated
if last_name:
user_to_update.last_name = last_name

user_to_update.save()

Choose a reason for hiding this comment

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

Try to use update function

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