-
Notifications
You must be signed in to change notification settings - Fork 858
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
Implemented solution #839
base: master
Are you sure you want to change the base?
Implemented solution #839
Conversation
db/models.py
Outdated
from django.db import models | ||
|
||
import settings |
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
from django.conf import settings
because it defines correct settings(as there may be a folder named settings)
db/models.py
Outdated
@@ -17,14 +23,19 @@ def __str__(self) -> str: | |||
|
|||
|
|||
class Movie(models.Model): | |||
title = models.CharField(max_length=255) | |||
title = models.CharField(max_length=255, db_index=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.
either db_index = True or indexes should be used. indexes are often used for complex indexes
|
||
|
||
class Order(models.Model): | ||
created_at = models.DateTimeField(default=datetime.datetime.now) |
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.
use auto_now_add instead
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.
I tried but It did not work due to mocking datetime. And It would be too strange to override save methods just to pass all the tests
db/models.py
Outdated
class Order(models.Model): | ||
created_at = models.DateTimeField(default=datetime.datetime.now) | ||
user = models.ForeignKey( | ||
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, |
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.
we don't add multiple parameters on the same line
services/movie.py
Outdated
@@ -6,6 +7,7 @@ | |||
def get_movies( | |||
genres_ids: list[int] = None, | |||
actors_ids: list[int] = None, | |||
title: str = None, |
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.
str or None
services/order.py
Outdated
def create_order( | ||
tickets: list[dict], | ||
username: str, | ||
date: str = None |
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.
str or None
services/order.py
Outdated
Ticket.objects.bulk_create(raw_tickets) | ||
|
||
|
||
def get_orders(username: str = None) -> QuerySet: |
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.
str or None
services/user.py
Outdated
def create_user( | ||
username: str, | ||
password: str, | ||
email: str = None, |
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.
str or None
services/user.py
Outdated
username: str = None, | ||
password: str = None, | ||
email: str = None, | ||
first_name: str = None, | ||
last_name: str = None |
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.
str or None
No description provided.