2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 00:07:08 +00:00

Show coordinates for entrance

Use filter to find coordinates
This commit is contained in:
Sam Wenham
2020-02-22 15:38:22 +00:00
parent de22b071b0
commit 505bc48331
5 changed files with 22 additions and 12 deletions

View File

@@ -372,6 +372,7 @@ class CaveAndEntrance(models.Model):
cave = models.ForeignKey('Cave')
entrance = models.ForeignKey('Entrance')
entrance_letter = models.CharField(max_length=20,blank=True,null=True)
def __unicode__(self):
return unicode(self.cave) + unicode(self.entrance_letter)
@@ -605,31 +606,35 @@ class Entrance(TroggleModel):
def exact_location(self):
return SurvexStation.objects.lookup(self.exact_station)
def other_location(self):
return SurvexStation.objects.lookup(self.other_station)
def find_location(self):
r = {'': 'To be entered ',
'?': 'To be confirmed:',
'?': 'To be confirmed:',
'S': '',
'L': 'Lost:',
'R': 'Refindable:'}[self.findability]
if self.tag_station:
try:
s = SurvexStation.objects.lookup(self.tag_station)
s = SurvexStation.objects.filter(name=self.tag_station)[:1]
s = s[0]
return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
except:
return r + "%s Tag Station not in dataset" % self.tag_station
if self.exact_station:
try:
s = SurvexStation.objects.lookup(self.exact_station)
s = SurvexStation.objects.filter(name=self.exact_station)[:1]
s = s[0]
return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
except:
return r + "%s Exact Station not in dataset" % self.tag_station
if self.other_station:
try:
s = SurvexStation.objects.lookup(self.other_station)
s = SurvexStation.objects.filter(name=self.other_station)[:1]
s = s[0]
return r + "%0.0fE %0.0fN %0.0fAlt %s" % (s.x, s.y, s.z, self.other_description)
except:
return r + "%s Other Station not in dataset" % self.tag_station