2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 15:21:52 +00:00

change on_delete to cascade for blocks in a file

This commit is contained in:
Philip Sargent 2023-03-22 23:29:12 +00:00
parent 838b358a4a
commit 1db7c5ffea

View File

@ -130,6 +130,7 @@ class SurvexBlockLookUpManager(models.Manager):
class SurvexBlock(models.Model): class SurvexBlock(models.Model):
"""One begin..end block within a survex file. The basic element of a survey trip. """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 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() objects = SurvexBlockLookUpManager() # overwrites SurvexBlock.objects and enables lookup()
@ -139,8 +140,9 @@ class SurvexBlock(models.Model):
date = models.DateField(blank=True, null=True) date = models.DateField(blank=True, null=True)
expedition = models.ForeignKey("Expedition", blank=True, null=True, on_delete=models.SET_NULL) expedition = models.ForeignKey("Expedition", 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,
survexfile = models.ForeignKey("SurvexFile", blank=True, null=True, on_delete=models.SET_NULL) # 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 survexpath = models.CharField(max_length=200) # the path for the survex stations
scanswallet = models.ForeignKey( scanswallet = models.ForeignKey(
@ -209,7 +211,8 @@ class SingleScan(models.Model):
class DrawingFile(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) dwgpath = models.CharField(max_length=200)
dwgname = models.CharField(max_length=200) dwgname = models.CharField(max_length=200)