-
Notifications
You must be signed in to change notification settings - Fork 1.5k
solution #1724
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
base: master
Are you sure you want to change the base?
solution #1724
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Generated by Django 6.0.5 on 2026-05-13 16:01 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='Guild', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('name', models.CharField(max_length=255, unique=True)), | ||
| ('description', models.TextField(null=True)), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Race', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('name', models.CharField(max_length=255, unique=True)), | ||
| ('description', models.TextField(blank=True)), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Player', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('nickname', models.CharField(max_length=255, unique=True)), | ||
| ('email', models.EmailField(max_length=255)), | ||
| ('bio', models.CharField(max_length=255)), | ||
| ('created_at', models.DateTimeField(auto_now_add=True)), | ||
| ('guild', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='guilds', to='db.guild')), | ||
| ('race', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='players', to='db.race')), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Skill', | ||
| fields=[ | ||
| ('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='races', to='db.race')), | ||
| ], | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,39 @@ | ||
| from django.db import models | ||
|
|
||
|
|
||
| class Race(models.Model): | ||
| name = models.CharField(max_length=255, unique=True) | ||
| description = models.TextField(blank=True) | ||
|
|
||
|
|
||
| class Skill(models.Model): | ||
| name = models.CharField(max_length=255, unique=True) | ||
| bonus = models.CharField(max_length=255) | ||
| race = models.ForeignKey( | ||
| Race, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
| on_delete=models.CASCADE, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
| related_name="races" | ||
|
Comment on lines
+11
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #3 violation: The |
||
| ) | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
|
|
||
| class Guild(models.Model): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
| name = models.CharField(max_length=255, unique=True) | ||
| description = models.TextField(null=True) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
|
|
||
|
|
||
| class Player(models.Model): | ||
| nickname = models.CharField(max_length=255, unique=True) | ||
| email = models.EmailField(max_length=255) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
| bio = models.CharField(max_length=255) | ||
| race = models.ForeignKey( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
| Race, | ||
| on_delete=models.CASCADE, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
| related_name="players" | ||
|
Comment on lines
+27
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #3 violation: The |
||
| ) | ||
| guild = models.ForeignKey( | ||
| Guild, | ||
| on_delete=models.SET_NULL, | ||
| related_name="guilds", | ||
| null=True | ||
| ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #5 violation: Use |
||
| created_at = models.DateTimeField(auto_now_add=True) | ||
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.
Checklist item #5 violation: Use
.get()method for dictionary key access instead of direct bracket notation. Changeplayer["race"]toplayer.get("race")to handle missing keys gracefully.