summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-03-22 23:29:12 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2023-03-22 23:29:12 +0000
commit1db7c5ffeafd9fd1f3f0a9c9de6a9d0e456a4364 (patch)
tree7ebbec61c1d9100c1c08055b309b118b3164948e
parent838b358a4a3cd4aaaaab6d7fa20e3748a89d6697 (diff)
downloadtroggle-1db7c5ffeafd9fd1f3f0a9c9de6a9d0e456a4364.tar.gz
troggle-1db7c5ffeafd9fd1f3f0a9c9de6a9d0e456a4364.tar.bz2
troggle-1db7c5ffeafd9fd1f3f0a9c9de6a9d0e456a4364.zip
change on_delete to cascade for blocks in a file
-rw-r--r--core/models/survex.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index 0e336ab..469628a 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -130,6 +130,7 @@ class SurvexBlockLookUpManager(models.Manager):
class SurvexBlock(models.Model):
"""One begin..end block within a survex file. The basic element of a survey trip.
Multiple anonymous survex blocks are possible within the same surfex file
+ Blocks can span several *included survexfile though.
"""
objects = SurvexBlockLookUpManager() # overwrites SurvexBlock.objects and enables lookup()
@@ -139,8 +140,9 @@ class SurvexBlock(models.Model):
date = models.DateField(blank=True, null=True)
expedition = models.ForeignKey("Expedition", blank=True, null=True, on_delete=models.SET_NULL)
-
- survexfile = models.ForeignKey("SurvexFile", blank=True, null=True, on_delete=models.SET_NULL)
+ # if the survexfile object is deleted, then all teh suvex-blocks in it should be too,
+ # though a block can span more than one file...
+ survexfile = models.ForeignKey("SurvexFile", blank=True, null=True, on_delete=models.CASCADE)
survexpath = models.CharField(max_length=200) # the path for the survex stations
scanswallet = models.ForeignKey(
@@ -209,7 +211,8 @@ class SingleScan(models.Model):
class DrawingFile(models.Model):
- """A file holding a Therion (several types) or a Tunnel drawing"""
+ """A file holding a Therion (several types) or a Tunnel drawing
+ Most of the implied capabilities are not implemented yet"""
dwgpath = models.CharField(max_length=200)
dwgname = models.CharField(max_length=200)