diff options
Diffstat (limited to 'core/models.py')
-rw-r--r-- | core/models.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/core/models.py b/core/models.py index 7b301f5..ca4556e 100644 --- a/core/models.py +++ b/core/models.py @@ -385,6 +385,20 @@ class Cave(TroggleModel): #href = models.CharField(max_length=100) + def hassurvey(self): + if not self.underground_centre_line: + return "No" + if (self.underground_centre_line.find("<img") > -1 or self.underground_centre_line.find("<a") > -1): + return "Yes" + return "Missing" + + def hassurveydata(self): + if not self.underground_centre_line: + return "No" + if self.survex_file: + return "Yes" + return "Missing" + def slug(self): primarySlugs = self.caveslug_set.filter(primary = True) if primarySlugs: @@ -394,6 +408,9 @@ class Cave(TroggleModel): if slugs: return slugs[0].slug + def ours(self): + return bool(re.search(r'CUCC', self.explorers)) + def reference(self): if self.kataster_number: return "%s-%s" % (self.kat_area(), self.kataster_number) @@ -431,6 +448,9 @@ class Cave(TroggleModel): def entrances(self): return CaveAndEntrance.objects.filter(cave=self) + + def singleentrance(self): + return len(CaveAndEntrance.objects.filter(cave=self)) == 1 def entrancelist(self): rs = [] @@ -534,6 +554,29 @@ class Entrance(TroggleModel): def __unicode__(self): return unicode(self.slug()) + + def find_location(self): + if self.tag_station: + s = SurvexStation.objects.lookup(self.tag_station) + return "%sE %sN %sAlt" % (s.x, s.y, s.z) + if self.exact_station: + s = SurvexStation.objects.lookup(self.exact_station) + return "%sE %sN %sAlt" % (s.x, s.y, s.z) + if self.other_station: + s = SurvexStation.objects.lookup(self.other_station) + return "%sE %sN %sAlt %s" % (s.x, s.y, s.z, self.other_description) + if self.bearings: + return self.bearings + + def has_photo(self): + if self.photo: + if (self.photo.find("<img") > -1 or self.photo.find("<a") > -1): + return "Yes" + else: + return "Missing" + else: + return "No" + def marking_val(self): for m in self.MARKING_CHOICES: if m[0] == self.marking: |