-
Notifications
You must be signed in to change notification settings - Fork 917
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 #426
base: master
Are you sure you want to change the base?
Solution #426
Conversation
main.py
Outdated
race = Race.objects.get_or_create( | ||
name=race_.get("name"), | ||
description=race_.get("description") | ||
)[0] |
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.
race = Race.objects.get_or_create( | |
name=race_.get("name"), | |
description=race_.get("description") | |
)[0] | |
race, _ = Race.objects.get_or_create( | |
name=race_.get("name"), | |
description=race_.get("description") | |
) |
Better to do like this)
Fix in all places
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.
Bu why its better?
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 is more clear code. If you know that it will return tuple with two params better to use:
variable, _
In all future project you will use this construction instead of [0]
[0] you can use if there unknown count of parameters
main.py
Outdated
email=email, | ||
bio=bio, | ||
guild=guild, | ||
race_id=race.id |
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.
race_id=race.id | |
race=race |
No description provided.