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

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

Solution #426

wants to merge 2 commits into from

Conversation

Davison322
Copy link

No description provided.

main.py Outdated
Comment on lines 17 to 20
race = Race.objects.get_or_create(
name=race_.get("name"),
description=race_.get("description")
)[0]

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Author

Choose a reason for hiding this comment

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

Bu why its better?

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

Choose a reason for hiding this comment

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

Suggested change
race_id=race.id
race=race

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