cascade or protect set

This commit is contained in:
Qwann 2018-08-08 16:56:24 +02:00
parent 70d1d403f6
commit 5b2207bd59
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-08-08 14:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('equipment', '0007_equipmentattribute_equipmentattributevalue'),
]
operations = [
migrations.AlterField(
model_name='equipment',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='equipment.EquipmentCategory'),
),
]

View file

@ -50,6 +50,7 @@ class Equipment(EventSpecificMixin, models.Model):
)
category = models.ForeignKey(
EquipmentCategory,
on_delete=models.PROTECT,
)
class Meta:
@ -77,6 +78,7 @@ class EquipmentAttribute(models.Model):
class EquipmentAttributeValue(models.Model):
equipment = models.ForeignKey(
Equipment,
on_delete=models.CASCADE,
related_name="attributes",
help_text=_("Matériel concerné par le defaut"),
)
@ -124,6 +126,7 @@ class EquipmentDefault(models.Model):
remark = models.TextField(_("remarque sur le défaut"))
equipment = models.ForeignKey(
Equipment,
on_delete=models.CASCADE,
related_name="remarks",
help_text=_("Matériel concerné par le defaut"),
)
@ -147,6 +150,7 @@ class EquipmentLost(models.Model):
)
equipment = models.ForeignKey(
Equipment,
on_delete=models.CASCADE,
related_name="losts",
help_text=_("Matériel concerné par la perte"),
)
@ -160,6 +164,7 @@ class EquipmentRevision(models.Model):
)
equipment = models.ForeignKey(
Equipment,
on_delete=models.CASCADE,
related_name="revisions",
help_text=_("Matériel concerné par les révisions"),
)