-
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 #993
base: master
Are you sure you want to change the base?
Solution #993
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. Make sure that all tests pass
db/models.py
Outdated
|
||
|
||
class Race(models.Model): | ||
PLAYER_CHOICES = ( |
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.
Please, define choices correctly and use them in case of definition
players = json.load(file) | ||
for player_name, player_data in players.items(): | ||
race_data = player_data["race"] | ||
race, created = Race.objects.get_or_create( |
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.
You could omit the second returned argument since it is not used
race, created = Race.objects.get_or_create( | |
race, _ = Race.objects.get_or_create( |
db/models.py
Outdated
PLAYER_CHOICES = ( | ||
("Elf", "Elf"), | ||
("Dwarf", "Dwarf"), | ||
("Human", "Human"), | ||
("Ork", "Ork"), | ||
) |
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.
If PLAYER_CHOICES
is not used in the code and only takes up space, you can remove it.
@@ -0,0 +1,24 @@ | |||
# Generated by Django 4.0.2 on 2024-10-16 15:49 |
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 a good practice to include one migration per app per PR in Django projects since it helps to avoid migrations folder overload in the future. Represent all changes done to models in one migration file per app per PR, please
class Skill(models.Model): | ||
name = models.CharField(max_length=255, unique=True) | ||
bonus = models.TextField(max_length=255) | ||
race = models.ForeignKey(Race, 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.
add related name for relational fields
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.
not resolved
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.
Tests Failed!
Please fix it!
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.
Tests Failed!
Please fix it!
@@ -0,0 +1,19 @@ | |||
# Generated by Django 4.0.2 on 2024-10-18 14:59 | |||
|
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 a good practice to include one migration per app per PR in Django projects since it helps to avoid migrations folder overload in the future. Represent all changes done to models in one migration file per app per PR, please
class Skill(models.Model): | ||
name = models.CharField(max_length=255, unique=True) | ||
bonus = models.TextField(max_length=255) | ||
race = models.ForeignKey(Race, 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.
not resolved
No description provided.