summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne@peacefrogs.net>2019-02-06 15:31:06 +0100
committerÉtienne Loks <etienne@peacefrogs.net>2019-02-06 15:31:06 +0100
commit4dc674ea9fa7516878a7b128da10ca9f09a6a1c7 (patch)
tree996f49e49c31c5c6644905ee3d9a3bf30da3bd1f /archaeological_context_records/models.py
parent4cbb3429c3243e93597c2d2fbc668b444499c728 (diff)
downloadIshtar-4dc674ea9fa7516878a7b128da10ca9f09a6a1c7.tar.bz2
Ishtar-4dc674ea9fa7516878a7b128da10ca9f09a6a1c7.zip
ForeignKey: SET_NULL fix
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 72b355ac9..56d43e295 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -66,8 +66,10 @@ class Dating(models.Model):
start_date = models.IntegerField(_(u"Start date"), blank=True, null=True)
end_date = models.IntegerField(_(u"End date"), blank=True, null=True)
dating_type = models.ForeignKey(DatingType, verbose_name=_(u"Dating type"),
+ on_delete=models.SET_NULL,
blank=True, null=True)
quality = models.ForeignKey(DatingQuality, verbose_name=_(u"Quality"),
+ on_delete=models.SET_NULL,
blank=True, null=True)
precise_dating = models.TextField(_(u"Precise dating"), blank=True,
null=True)
@@ -177,7 +179,7 @@ class Unit(GeneralType):
order = models.IntegerField(_(u"Order"))
parent = models.ForeignKey(
"Unit", verbose_name=_(u"Parent context record type"),
- blank=True, null=True)
+ on_delete=models.SET_NULL, blank=True, null=True)
class Meta:
verbose_name = _(u"Context record Type")
@@ -403,14 +405,15 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
_(u"External ID is set automatically"), default=False)
parcel = models.ForeignKey(
Parcel, verbose_name=_(u"Parcel"), related_name='context_record',
- blank=True, null=True)
+ on_delete=models.SET_NULL, blank=True, null=True)
town = models.ForeignKey(
Town, verbose_name=_(u"Town"), related_name='context_record',
- blank=True, null=True)
+ on_delete=models.SET_NULL, blank=True, null=True)
operation = models.ForeignKey(Operation, verbose_name=_(u"Operation"),
related_name='context_record')
archaeological_site = models.ForeignKey(
ArchaeologicalSite, verbose_name=_(u"Archaeological site"),
+ on_delete=models.SET_NULL,
blank=True, null=True, related_name='context_records')
label = models.CharField(_(u"ID"), max_length=200)
description = models.TextField(_(u"Description"), blank=True, null=True)
@@ -435,6 +438,7 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
datings_comment = models.TextField(_(u"Comment on datings"), blank=True,
null=True)
unit = models.ForeignKey(Unit, verbose_name=_(u"Context record type"),
+ on_delete=models.SET_NULL,
related_name='+', blank=True, null=True)
filling = models.TextField(_(u"Filling"), blank=True, null=True)
interpretation = models.TextField(_(u"Interpretation"), blank=True,
@@ -455,11 +459,14 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
help_text=_(u"Estimation of a \"Terminus Post Quem\""))
identification = models.ForeignKey(
IdentificationType, blank=True, null=True,
+ on_delete=models.SET_NULL,
verbose_name=_(u"Identification"),)
activity = models.ForeignKey(ActivityType, blank=True, null=True,
+ on_delete=models.SET_NULL,
verbose_name=_(u"Activity"),)
excavation_technic = models.ForeignKey(
ExcavationTechnicType, blank=True, null=True,
+ on_delete=models.SET_NULL,
verbose_name=_(u"Excavation technique"))
related_context_records = models.ManyToManyField(
'ContextRecord', through='RecordRelations', blank=True)