diff options
Diffstat (limited to 'core/models/survex.py')
-rw-r--r-- | core/models/survex.py | 14 |
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: |