Skip to content

Solution#1710

Open
smykroman-dot wants to merge 2 commits into
mate-academy:masterfrom
smykroman-dot:develop
Open

Solution#1710
smykroman-dot wants to merge 2 commits into
mate-academy:masterfrom
smykroman-dot:develop

Conversation

@smykroman-dot
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@lubkoserhii lubkoserhii left a comment

Choose a reason for hiding this comment

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

Привіт, додай файл з міграцією. Тести тому й не пройшли, що немає файлу міграції

@smykroman-dot smykroman-dot requested a review from lubkoserhii May 11, 2026 07:14
Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Your implementation correctly fulfills all core functional requirements—models have proper field types, on_delete behaviors, and the main() function properly uses get_or_create(). However, there is a critical checklist violation: all ForeignKey fields are missing the required related_name parameter. Per checklist item #3, each ForeignKey must include related_name to enable reverse access from the "one" side. You need to add: related_name='skills' to Skill.race, related_name='players' to Player.race and Guild.players, and related_name='members' to Player.guild. After adding these, you'll need to generate a new migration to capture the changes. The good news is that your core database structure and logic are solid—only these relationship names need to be added.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread db/models.py
Comment on lines +11 to +12
bonus = models.CharField(max_length=255)
race = models.ForeignKey(Race, on_delete=models.CASCADE)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: Missing related_name on this ForeignKey. Add related_name='skills' to allow reverse access from Race to Skill model.

Comment thread db/models.py
Comment on lines +24 to +25
race = models.ForeignKey(Race, on_delete=models.CASCADE)
guild = models.ForeignKey(Guild, on_delete=models.SET_NULL, null=True)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: Missing related_name on this ForeignKey. Add related_name='players' to allow reverse access from Guild to Player model.

Comment thread db/models.py
Comment on lines +23 to +24
bio = models.CharField(max_length=255)
race = models.ForeignKey(Race, on_delete=models.CASCADE)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: Missing related_name on this ForeignKey. Add related_name='players' to allow reverse access from Race to Player model.

Comment thread main.py
with open("players.json") as file:
players = json.load(file)

for nickname, player in players.items():
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: ForeignKey field is missing related_name. Add related_name='skills' to allow access to skills from the Race side.

Comment thread main.py

for skill in race_data.get("skills", []):
Skill.objects.get_or_create(
name=skill["name"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: ForeignKey field is missing related_name. Add related_name='players' to allow access to players from the Race side.

Comment thread main.py
for skill in race_data.get("skills", []):
Skill.objects.get_or_create(
name=skill["name"],
defaults={
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3 violation: ForeignKey field is missing related_name. Add related_name='members' to allow access to members from the Guild side.

initial = True

dependencies = [
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3: This ForeignKey is missing related_name. Add a related_name (e.g., related_name='skills') to allow reverse access from Race to Skills.

),
migrations.CreateModel(
name='Race',
fields=[
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3: This ForeignKey is missing related_name. Add a related_name (e.g., related_name='players') to allow reverse access from Guild to Players.

],
),
migrations.CreateModel(
name='Race',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3: This ForeignKey is missing related_name. Add a related_name (e.g., related_name='players') to allow reverse access from Race to Players.

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