-
Notifications
You must be signed in to change notification settings - Fork 859
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 #915
base: master
Are you sure you want to change the base?
Solution #915
Conversation
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.
Great job on following the checklist and ensuring your code is well-structured! 🎉 While there are a few minor improvements suggested, they don't impact the core functionality. Keep up the good work and consider the feedback for future enhancements!
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
class Meta: | ||
indexes = [ | ||
models.Index(fields=["title"]) | ||
] |
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.
The class Meta
should be defined after all attributes of the Movie
class. Currently, it is placed before the __str__
method, which is not recommended according to the checklist.
from django.db import transaction | ||
from django.core.exceptions import ValidationError | ||
from django.db.models import 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.
According to the checklist, use get_user_model()
instead of User
for better practice when dealing with user models.
order = Order.objects.create(user=user) | ||
if date: | ||
try: | ||
order.created_at = datetime.strptime(date, "%Y-%m-%d %H:%M") |
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.
There is a typo in the error message: 'formate' should be 'format'.
services/order.py
Outdated
else: | ||
order.created_at = timezone.now() | ||
|
||
order.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.
According to the checklist, avoid calling save()
multiple times if possible. Consider setting all attributes before saving the order.
"db", | ||
] | ||
|
||
AUTH_USER_MODEL = "db.User" |
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.
The AUTH_USER_MODEL setting should use the get_user_model() function instead of directly referencing the model string. This is a best practice to ensure compatibility and flexibility in your Django project.
No description provided.