summaryrefslogtreecommitdiffstats
path: root/core/models/survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-09-06 17:19:20 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-09-06 17:19:20 +0300
commit0dc0e275193457d1875ca1690168112a61b4bca4 (patch)
tree774f1c92d20fedcdaf10e48c6843b536af64341b /core/models/survex.py
parent3c6cae20eda7dc060aa5bc3fe8da400699130025 (diff)
downloadtroggle-0dc0e275193457d1875ca1690168112a61b4bca4.tar.gz
troggle-0dc0e275193457d1875ca1690168112a61b4bca4.tar.bz2
troggle-0dc0e275193457d1875ca1690168112a61b4bca4.zip
moving primary survex file to each survexfile
Diffstat (limited to 'core/models/survex.py')
-rw-r--r--core/models/survex.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index 835d31d..2ca7412 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -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: