-
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 game-models #439
base: master
Are you sure you want to change the base?
Solution game-models #439
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.
Several changes were requested.
main.py
Outdated
print(new_player) | ||
print("---------------") |
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.
Delete these prints, they are not needed.
main.py
Outdated
name=guild_name, | ||
description=guild.get("description") | ||
) | ||
guild_from_db = Guild.objects.get(name=guild_name) |
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 no need to query the database additionally in case you create a record, .create()
will return the required object. You need to write it to a variable. Execute .get()
in the else
statement to achieve that.
main.py
Outdated
if not Race.objects.filter(name=race_name).exists(): | ||
Race.objects.create( | ||
name=race_name, | ||
description=race_.get("description") | ||
) | ||
race_from_db = Race.objects.get(name=race_name) |
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 no need to query the database additionally in case you create a record, .create()
will return the required object. You need to write it to a variable. Execute .get()
in the else
statement to achieve that.
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.
Good job!
No description provided.