Improve README

Make new style QMs from survexfiles work
This commit is contained in:
Sam Wenham
2019-07-19 01:04:18 +01:00
parent 08a41941f9
commit de22b071b0
13 changed files with 179 additions and 112 deletions

View File

@@ -47,6 +47,8 @@ class SurvexFile(models.Model):
def SetDirectory(self):
dirpath = os.path.split(self.path)[0]
survexdirectorylist = SurvexDirectory.objects.filter(cave=self.cave, path=dirpath)
# if self.cave is '' or self.cave is None:
# print('No cave set for survex dir %s' % self.path)
if survexdirectorylist:
self.survexdirectory = survexdirectorylist[0]
else:
@@ -74,8 +76,11 @@ class SurvexStation(models.Model):
z = models.FloatField(blank=True, null=True)
def __unicode__(self):
return self.block.cave.slug() + '/' + self.block.name + '/' + self.name or 'No station name'
if self.block.cave:
# If we haven't got a cave we can't have a slug, saves a nonetype return
return self.block.cave.slug() + '/' + self.block.name + '/' + self.name or 'No station name'
else:
return str(self.block.cave) + '/' + self.block.name + '/' + self.name or 'No station name'
def path(self):
r = self.name
b = self.block