summaryrefslogtreecommitdiffstats
path: root/core/models/survex.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/models/survex.py')
-rw-r--r--core/models/survex.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index 469628a..cdc8a80 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -27,8 +27,11 @@ class SurvexDirectory(models.Model):
ordering = ("id",)
verbose_name_plural = "Survex directories"
+ def contents(self):
+ return "[SvxDir:" + str(self.path) + " | Primary svx:" + str(self.primarysurvexfile.path) + ".svx ]"
+
def __str__(self):
- return "[SurvexDirectory:" + str(self.path) + " | Primary svx:" + str(self.primarysurvexfile.path) + ".svx ]"
+ return "[SvxDir:" + str(self.path)+ "]"
class SurvexFile(models.Model):
@@ -44,13 +47,11 @@ class SurvexFile(models.Model):
# return "[SurvexFile:"+str(self.path) + "-" + str(self.survexdirectory) + "-" + str(self.cave)+"]"
def exists(self):
+ """This is only used within the Django templates
+ """
fname = Path(settings.SURVEX_DATA, self.path + ".svx")
return fname.is_file()
- def OpenFile(self):
- fname = os.path.join(settings.SURVEX_DATA, self.path + ".svx")
- return open(fname)
-
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..
@@ -64,6 +65,10 @@ class SurvexFile(models.Model):
self.survexdirectory = survexdirectory
self.save()
+ # Don't change from the default as that breaks troggle webpages and internal referencing!
+ # def __str__(self):
+ # return "[SurvexFile:"+str(self.path) + "-" + str(self.survexdirectory) + "-" + str(self.cave)+"]"
+
def __str__(self):
return self.path