-
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
Develop #1009
base: master
Are you sure you want to change the base?
Develop #1009
Conversation
main.py
Outdated
directory = os.path.join("db", "tests", "players.json") | ||
|
||
with open(directory, "r") as data_players: | ||
players = json.load(data_players) |
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.
Also you can just write:
with open("players.json") as data_players
And it will works without directoty variable
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.
Thank you for your hard work on this Pull Request! There are a few critical issues that need to be addressed before we can proceed. The ForeignKey
references in your migration files need to be corrected to ensure they point to the correct models. Specifically, the to
parameter should reference the model names directly, such as 'Race'
and 'Guild'
, instead of using 'db.race'
or 'db.guild'
. Additionally, please ensure that the related_name
for the Skill
model is set to "skills"
as per the task requirements. Once these changes are made, your code will be in great shape! Keep up the great work! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=255, unique=True)), | ||
('bonus', models.CharField(max_length=255)), | ||
('race', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='skills', to='db.race')), |
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.
The 'to' parameter in the ForeignKey should be 'Race' instead of 'db.race'. Ensure that the app label is correctly referenced if it's not the default app.
('email', models.EmailField(max_length=255)), | ||
('bio', models.CharField(max_length=255)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('guild', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='players', to='db.guild')), |
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.
The 'to' parameter in the ForeignKey should be 'Guild' instead of 'db.guild'. Ensure that the app label is correctly referenced if it's not the default app.
('bio', models.CharField(max_length=255)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('guild', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='players', to='db.guild')), | ||
('race', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='players', to='db.race')), |
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.
The 'to' parameter in the ForeignKey should be 'Race' instead of 'db.race'. Ensure that the app label is correctly referenced if it's not the default app.
migrations.AlterField( | ||
model_name='player', | ||
name='guild', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='players', to='db.guild'), |
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.
The 'to' parameter in the ForeignKey should be 'Guild' instead of 'db.guild'. Ensure that the app label is correctly referenced if it's not the default app.
migrations.AlterField( | ||
model_name='skill', | ||
name='race', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='skill_set', to='db.race'), |
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.
The 'to' parameter in the ForeignKey should be 'Race' instead of 'db.race'. Ensure that the app label is correctly referenced if it's not the default app.
email=email, | ||
bio=bio, | ||
race=race, | ||
guild=guild |
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 a potential issue here: if 'guild' is not present in the player data, the 'guild' variable will be undefined when passed to Player.objects.create. Consider initializing 'guild' to None before the if statement to avoid this issue.
No description provided.