summaryrefslogtreecommitdiffstats
path: root/core/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/models.py')
-rw-r--r--core/models.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/models.py b/core/models.py
index 46a86da..af25107 100644
--- a/core/models.py
+++ b/core/models.py
@@ -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