diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-09-06 22:58:14 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-09-06 22:58:14 +0300 |
commit | 69340db43874d1ed9a2c4d27595c090016dc4c55 (patch) | |
tree | cc485c7dfb63b0ae3929b93354d1a552c4fbbd80 /core/models/survex.py | |
parent | 1ddb8248dff14b819c0037b9f59d68aedeba9829 (diff) | |
download | troggle-69340db43874d1ed9a2c4d27595c090016dc4c55.tar.gz troggle-69340db43874d1ed9a2c4d27595c090016dc4c55.tar.bz2 troggle-69340db43874d1ed9a2c4d27595c090016dc4c55.zip |
SurvexDirectory removed from active code
Diffstat (limited to 'core/models/survex.py')
-rw-r--r-- | core/models/survex.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/core/models/survex.py b/core/models/survex.py index 2ca7412..84255d7 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -11,33 +11,33 @@ from django.urls import reverse # from troggle.core.models.troggle import DataIssue # circular import. Hmm -class SurvexDirectory(models.Model): - """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. +# class SurvexDirectory(models.Model): + # """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) - primarysurvexfile = models.ForeignKey( - "SurvexFile", related_name="primarysurvexfile", blank=True, null=True, on_delete=models.SET_NULL - ) + # But it *could* be a property of SurvexFile + # """ + # path = models.CharField(max_length=200) + # primarysurvexfile = models.ForeignKey( + # "SurvexFile", related_name="primarysurvexfile", blank=True, null=True, on_delete=models.SET_NULL + # ) - class Meta: - ordering = ("id",) - verbose_name_plural = "Survex directories" + # class Meta: + # ordering = ("id",) + # verbose_name_plural = "Survex directories" - def contents(self): - return "[SvxDir:" + str(self.path) + " | Primary svx:" + str(self.primarysurvexfile.path) + ".svx ]" + # def contents(self): + # return "[SvxDir:" + str(self.path) + " | Primary svx:" + str(self.primarysurvexfile.path) + ".svx ]" - def __str__(self): - return "[SvxDir:" + str(self.path)+ "]" + # def __str__(self): + # return "[SvxDir:" + str(self.path)+ "]" class SurvexFile(models.Model): path = models.CharField(max_length=200) - survexdirectory = models.ForeignKey("SurvexDirectory", blank=True, null=True, on_delete=models.SET_NULL) + #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 ) @@ -56,18 +56,18 @@ class SurvexFile(models.Model): fname = Path(settings.SURVEX_DATA, self.path + ".svx") return fname.is_file() - def SetDirectory(self): - dirpath = os.path.split(self.path)[0] - # pointless search every time we import a survex file if we know there are no duplicates.. - # don't use this for initial import. - survexdirectorylist = SurvexDirectory.objects.filter(cave=self.cave, path=dirpath) - if survexdirectorylist: - self.survexdirectory = survexdirectorylist[0] - else: - survexdirectory = SurvexDirectory(path=dirpath, cave=self.cave, primarysurvexfile=self) - survexdirectory.save() - self.survexdirectory = survexdirectory - self.save() + # def SetDirectory(self): + # dirpath = os.path.split(self.path)[0] + # # pointless search every time we import a survex file if we know there are no duplicates.. + # # don't use this for initial import. + # survexdirectorylist = SurvexDirectory.objects.filter(cave=self.cave, path=dirpath) + # if survexdirectorylist: + # self.survexdirectory = survexdirectorylist[0] + # else: + # survexdirectory = SurvexDirectory(path=dirpath, cave=self.cave, primarysurvexfile=self) + # survexdirectory.save() + # self.survexdirectory = survexdirectory + # self.save() # Don't change from the default as that breaks troggle webpages and internal referencing! # def __str__(self): |