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", model_name="operation",
name="linked_operation", name="linked_operation",
field=models.OneToOneField( field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
blank=True, blank=True,
to="accounting.Operation", to="accounting.Operation",
null=True, null=True,

View File

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

View File

@ -5,6 +5,7 @@ from django.db import migrations, models
from club.models import Club from club.models import Club
from core.operations import PsqlRunOnly from core.operations import PsqlRunOnly
import django.db.models.deletion
def generate_club_pages(apps, schema_editor): def generate_club_pages(apps, schema_editor):
@ -31,7 +32,11 @@ class Migration(migrations.Migration):
model_name="club", model_name="club",
name="page", name="page",
field=models.OneToOneField( 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( migrations.AddField(

View File

@ -277,6 +277,7 @@ class Migration(migrations.Migration):
( (
"group_ptr", "group_ptr",
models.OneToOneField( models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
primary_key=True, primary_key=True,
parent_link=True, parent_link=True,
serialize=False, serialize=False,
@ -431,7 +432,9 @@ class Migration(migrations.Migration):
( (
"user", "user",
models.OneToOneField( 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", model_name="user",
name="home", name="home",
field=models.OneToOneField( field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
blank=True, blank=True,
null=True, null=True,
related_name="home_of", related_name="home_of",

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
from django.conf import settings from django.conf import settings
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -35,7 +36,9 @@ class Migration(migrations.Migration):
model_name="preferences", model_name="preferences",
name="user", name="user",
field=models.OneToOneField( 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", "user",
models.OneToOneField( 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 __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -32,6 +33,7 @@ class Migration(migrations.Migration):
( (
"product", "product",
models.OneToOneField( models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
verbose_name="product", verbose_name="product",
related_name="eticket", related_name="eticket",
to="counter.Product", to="counter.Product",

View File

@ -232,7 +232,9 @@ class Migration(migrations.Migration):
( (
"user", "user",
models.OneToOneField( 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", "counter",
models.OneToOneField( models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="launderette", related_name="launderette",
verbose_name="counter", verbose_name="counter",
to="counter.Counter", to="counter.Counter",

View File

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

View File

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