Specify the on_delete strategy
- Remove an absurd debug line in the migration - Specify the on_delete strategy for the club-related models
This commit is contained in:
parent
f8a8465630
commit
7d1c1fc868
2 changed files with 8 additions and 5 deletions
|
@ -64,7 +64,6 @@ class Migration(migrations.Migration):
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RunPython(lambda: 1/0),
|
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Club',
|
name='Club',
|
||||||
fields=[
|
fields=[
|
||||||
|
@ -82,8 +81,12 @@ class Migration(migrations.Migration):
|
||||||
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
|
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
|
||||||
('is_respo', models.BooleanField(verbose_name='Est responsable du club')),
|
('is_respo', models.BooleanField(verbose_name='Est responsable du club')),
|
||||||
('has_paid', models.BooleanField(verbose_name='A payé sa cotisation')),
|
('has_paid', models.BooleanField(verbose_name='A payé sa cotisation')),
|
||||||
('club', models.ForeignKey(to='gestion.Club')),
|
('club', models.ForeignKey(
|
||||||
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
|
to='gestion.Club',
|
||||||
|
on_delete=models.CASCADE)),
|
||||||
|
('user', models.ForeignKey(
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Club(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class ClubUser(models.Model):
|
class ClubUser(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
club = models.ForeignKey(Club)
|
club = models.ForeignKey(Club, on_delete=models.CASCADE)
|
||||||
is_respo = models.BooleanField(_("Est responsable du club"))
|
is_respo = models.BooleanField(_("Est responsable du club"))
|
||||||
has_paid = models.BooleanField(_("A payé sa cotisation"))
|
has_paid = models.BooleanField(_("A payé sa cotisation"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue