django2.2: add on_delete on migrations for OneToOneField

This commit is contained in:
Antoine Bartuccio 2019-10-06 00:38:25 +02:00
parent 3cb306bc91
commit f7548ab8d1
Signed by: klmp200
GPG Key ID: E7245548C53F904B
11 changed files with 37 additions and 6 deletions

View File

@ -40,6 +40,7 @@ class Migration(migrations.Migration):
model_name="operation",
name="linked_operation",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
blank=True,
to="accounting.Operation",
null=True,

View File

@ -36,6 +36,7 @@ class Migration(migrations.Migration):
model_name="club",
name="home",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
blank=True,
null=True,
related_name="home_of_club",

View File

@ -5,6 +5,7 @@ from django.db import migrations, models
from club.models import Club
from core.operations import PsqlRunOnly
import django.db.models.deletion
def generate_club_pages(apps, schema_editor):
@ -31,7 +32,11 @@ class Migration(migrations.Migration):
model_name="club",
name="page",
field=models.OneToOneField(
related_name="club", blank=True, null=True, to="core.Page"
on_delete=django.db.models.deletion.CASCADE,
related_name="club",
blank=True,
null=True,
to="core.Page",
),
),
migrations.AddField(

View File

@ -277,6 +277,7 @@ class Migration(migrations.Migration):
(
"group_ptr",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
primary_key=True,
parent_link=True,
serialize=False,
@ -431,7 +432,9 @@ class Migration(migrations.Migration):
(
"user",
models.OneToOneField(
to=settings.AUTH_USER_MODEL, related_name="preferences"
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
related_name="preferences",
),
),
],
@ -525,6 +528,7 @@ class Migration(migrations.Migration):
model_name="user",
name="home",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
blank=True,
null=True,
related_name="home_of",

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
import django.db.models.deletion
class Migration(migrations.Migration):
@ -35,7 +36,9 @@ class Migration(migrations.Migration):
model_name="preferences",
name="user",
field=models.OneToOneField(
related_name="_preferences", to=settings.AUTH_USER_MODEL
on_delete=django.db.models.deletion.CASCADE,
related_name="_preferences",
to=settings.AUTH_USER_MODEL,
),
),
]

View File

@ -66,7 +66,10 @@ class Migration(migrations.Migration):
(
"user",
models.OneToOneField(
primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL
on_delete=django.db.models.deletion.CASCADE,
primary_key=True,
serialize=False,
to=settings.AUTH_USER_MODEL,
),
),
(

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
@ -32,6 +33,7 @@ class Migration(migrations.Migration):
(
"product",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
verbose_name="product",
related_name="eticket",
to="counter.Product",

View File

@ -232,7 +232,9 @@ class Migration(migrations.Migration):
(
"user",
models.OneToOneField(
to=settings.AUTH_USER_MODEL, related_name="_forum_infos"
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
related_name="_forum_infos",
),
),
],

View File

@ -26,6 +26,7 @@ class Migration(migrations.Migration):
(
"counter",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="launderette",
verbose_name="counter",
to="counter.Counter",

View File

@ -86,6 +86,7 @@ class Migration(migrations.Migration):
(
"counter",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
verbose_name="counter",
related_name="stock",
to="counter.Counter",

View File

@ -51,7 +51,14 @@ class Migration(migrations.Migration):
verbose_name="maximum characters",
),
),
("club", models.OneToOneField(to="club.Club", related_name="trombi")),
(
"club",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="club.Club",
related_name="trombi",
),
),
],
),
migrations.CreateModel(
@ -115,6 +122,7 @@ class Migration(migrations.Migration):
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
verbose_name="trombi user",
to=settings.AUTH_USER_MODEL,
related_name="trombi_user",