2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 03:29:39 +00:00

moving primary survex file to each survexfile

This commit is contained in:
2023-09-06 17:19:20 +03:00
parent 3c6cae20ed
commit 0dc0e27519
7 changed files with 64 additions and 47 deletions

View File

@@ -12,16 +12,17 @@ from django.urls import reverse
class SurvexDirectory(models.Model):
"""This relates a Cave to the primary SurvexFile which is the 'head' of the survex tree for
that cave. Surely this could just be a property of Cave ? No. Several subdirectories
all relate to the same Cave
"""This relates a survexfile (identified by path) to the primary SurvexFile
which is the 'head' of the survex tree for that cave.
Surely this could just be a property of Cave ? No. Several subdirectories
all relate to the same Cave.
But it *could* be a property of SurvexFile
"""
path = models.CharField(max_length=200)
# cave = models.ForeignKey("Cave", blank=True, null=True, on_delete=models.SET_NULL) # apparently NEVER USED
primarysurvexfile = models.ForeignKey(
"SurvexFile", related_name="primarysurvexfile", blank=True, null=True, on_delete=models.SET_NULL
)
# could also include files in directory but not referenced
class Meta:
ordering = ("id",)
@@ -37,6 +38,9 @@ class SurvexDirectory(models.Model):
class SurvexFile(models.Model):
path = models.CharField(max_length=200)
survexdirectory = models.ForeignKey("SurvexDirectory", blank=True, null=True, on_delete=models.SET_NULL)
primary = models.ForeignKey(
"SurvexFile", related_name="primarysurvex", blank=True, null=True, on_delete=models.SET_NULL
)
cave = models.ForeignKey("Cave", blank=True, null=True, on_delete=models.SET_NULL)
class Meta: