diff options
Diffstat (limited to 'core/models/survex.py')
-rw-r--r-- | core/models/survex.py | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/core/models/survex.py b/core/models/survex.py index 50173f4..1273a8b 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -15,10 +15,10 @@ class SurvexDirectory(models.Model): class Meta: ordering = ('id',) + verbose_name_plural = "Survex directories" - # Don't change from the default as that breaks troggle webpages and internal referencing! - # def __str__(self): - # return "[SurvexDirectory:"+str(self.path) + "-" + str(self.primarysurvexfile.path) + "-" + str(self.cave)+"]" + def __str__(self): + return "[SurvexDirectory:"+str(self.path) + "-" + str(self.primarysurvexfile.path) + "-" + str(self.cave)+"]" class SurvexFile(models.Model): @@ -53,7 +53,9 @@ class SurvexFile(models.Model): survexdirectory.save() self.survexdirectory = survexdirectory self.save() - + + def __str__(self): + return self.path class SurvexStationLookUpManager(models.Manager): def lookup(self, name): @@ -122,11 +124,11 @@ class SurvexBlock(models.Model): class Meta: ordering = ('id',) - # Don't change from the original as that breaks troggle webpages and internal referencing! - # def __str__(self): - # return "[SurvexBlock:"+ str(self.name) + "-path:" + \ - # str(self.survexpath) + "-cave:" + \ - # str(self.cave) + "]" + def __str__(self): + return "[SurvexBlock:"+ str(self.name) + "-path:" + \ + str(self.survexpath) + "-cave:" + \ + str(self.cave) + "]" + def __str__(self): return self.name and str(self.name) or 'no name' @@ -134,40 +136,19 @@ class SurvexBlock(models.Model): return True def GetPersonroles(self): - '''To do: excise the 'role' bit of this while retaining personrole - which is used in some later logic - + ''' But apparently never used !? ''' res = [ ] for personrole in self.survexpersonrole_set.order_by('personexpedition'): - # if res and res[-1]['person'] == personrole.personexpedition.person: - # res[-1]['roles'] += ", " + str(personrole.nrole) - # else: - # res.append({'person':personrole.personexpedition.person, 'expeditionyear':personrole.personexpedition.expedition.year, 'roles':str(personrole.nrole)}) res.append({'person':personrole.personexpedition.person, 'expeditionyear':personrole.personexpedition.expedition.year}) return res def DayIndex(self): return list(self.expeditionday.survexblock_set.all()).index(self) -# -# member of a SurvexBlock -# -# ROLE_CHOICES = ( - # ('insts','Instruments'), - # ('dog','Other'), - # ('notes','Notes'), - # ('pics','Pictures'), - # ('tape','Tape measure'), - # ('useless','Useless'), - # ('helper','Helper'), - # ('disto','Disto'), - # ('consultant','Consultant'), - # ) class SurvexPersonRole(models.Model): survexblock = models.ForeignKey('SurvexBlock',on_delete=models.CASCADE) -# nrole = models.CharField(choices=ROLE_CHOICES, max_length=200, blank=True, null=True) # increasing levels of precision personname = models.CharField(max_length=100) person = models.ForeignKey('Person', blank=True, null=True,on_delete=models.SET_NULL) @@ -176,7 +157,7 @@ class SurvexPersonRole(models.Model): expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL) def __str__(self): - return str(self.person) + " - " + str(self.survexblock) + " - " + str(self.nrole) + return str(self.person) + " - " + str(self.survexblock) class Wallet(models.Model): fpath = models.CharField(max_length=200) @@ -189,7 +170,7 @@ class Wallet(models.Model): return urljoin(settings.URL_ROOT, reverse('singlewallet', kwargs={"path":re.sub("#", "%23", self.walletname)})) def __str__(self): - return str(self.walletname) + " (Survey Scans Folder)" + return str(self.walletname) + " (Wallet)" class SingleScan(models.Model): ffile = models.CharField(max_length=200) @@ -216,4 +197,8 @@ class DrawingFile(models.Model): survexfiles = models.ManyToManyField("SurvexFile") # direct link to SVX files - not populated yet class Meta: - ordering = ('dwgpath',)
\ No newline at end of file + ordering = ('dwgpath',) + + def __str__(self): + return "Drawing File: " + str(self.dwgname) + " (" + str(self.filesize) + " bytes)" +
\ No newline at end of file |