Consistency for on_delete attributes

This commit is contained in:
Ludovic Stephan 2019-06-03 22:43:47 +02:00
parent 51fe9cc9f8
commit f3dbb72f69
3 changed files with 27 additions and 39 deletions

View file

@ -29,18 +29,6 @@ class Migration(migrations.Migration):
to="kfet.Checkout",
),
),
migrations.AlterField(
model_name="inventory",
name="order",
field=models.OneToOneField(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="inventory",
to="kfet.Order",
),
),
migrations.AlterField(
model_name="inventoryarticle",
name="article",
@ -67,18 +55,6 @@ class Migration(migrations.Migration):
to="kfet.Article",
),
),
migrations.AlterField(
model_name="operationgroup",
name="valid_by",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="kfet.Account",
),
),
migrations.AlterField(
model_name="order",
name="supplier",
@ -116,18 +92,6 @@ class Migration(migrations.Migration):
on_delete=django.db.models.deletion.CASCADE, to="kfet.Supplier"
),
),
migrations.AlterField(
model_name="transfergroup",
name="valid_by",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="kfet.Account",
),
),
migrations.DeleteModel(name="ArticleRule"),
migrations.DeleteModel(name="CheckoutTransfer"),
]

View file

@ -70,6 +70,18 @@ class Migration(migrations.Migration):
to="kfet.Account",
),
),
migrations.AlterField(
model_name="operationgroup",
name="valid_by",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=models.SET(kfet.models.get_deleted_account),
related_name="+",
to="kfet.Account",
),
),
migrations.AlterField(
model_name="transfer",
name="canceled_by",
@ -100,4 +112,16 @@ class Migration(migrations.Migration):
to="kfet.Account",
),
),
migrations.AlterField(
model_name="transfergroup",
name="valid_by",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=models.SET(kfet.models.get_deleted_account),
related_name="+",
to="kfet.Account",
),
),
]

View file

@ -530,7 +530,7 @@ class Inventory(models.Model):
# Optional
order = models.OneToOneField(
"Order",
on_delete=models.CASCADE,
on_delete=models.PROTECT,
related_name="inventory",
blank=True,
null=True,
@ -618,7 +618,7 @@ class TransferGroup(models.Model):
comment = models.CharField(max_length=255, blank=True, default="")
valid_by = models.ForeignKey(
Account,
on_delete=models.SET_NULL,
on_delete=models.SET(get_deleted_account),
related_name="+",
blank=True,
null=True,
@ -668,7 +668,7 @@ class OperationGroup(models.Model):
comment = models.CharField(max_length=255, blank=True, default="")
valid_by = models.ForeignKey(
Account,
on_delete=models.SET_NULL,
on_delete=models.SET(get_deleted_account),
related_name="+",
blank=True,
null=True,