diff options
-rw-r--r-- | core/admin.py | 6 | ||||
-rw-r--r-- | core/models.py | 13 | ||||
-rw-r--r-- | parsers/logbooks.py | 4 | ||||
-rw-r--r-- | parsers/survex.py | 2 | ||||
-rw-r--r-- | templates/cave.html | 9 |
5 files changed, 22 insertions, 12 deletions
diff --git a/core/admin.py b/core/admin.py index 392e346..0b7cf13 100644 --- a/core/admin.py +++ b/core/admin.py @@ -28,6 +28,10 @@ class SurvexBlockAdmin(TroggleModelAdmin): inlines = (RoleInline,) +class SurvexStationAdmin(TroggleModelAdmin): + search_fields = ('name', 'block__name') + + class ScannedImageInline(admin.TabularInline): model = ScannedImage extra = 4 @@ -136,7 +140,7 @@ admin.site.register(ScannedImage) admin.site.register(SurvexDirectory) admin.site.register(SurvexFile) -admin.site.register(SurvexStation) +admin.site.register(SurvexStation, SurvexStationAdmin) admin.site.register(SurvexBlock) admin.site.register(SurvexPersonRole) admin.site.register(SurvexScansFolder) 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 diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 012d771..7c3189f 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -32,6 +32,7 @@ def GetTripPersons(trippeople, expedition, logtime_underground): round_bracket_regex = re.compile(r"[\(\[].*?[\)\]]") for tripperson in re.split(r",|\+|&|&(?!\w+;)| and ", trippeople): tripperson = tripperson.strip() + tripperson = tripperson.strip('.') mul = re.match(r"<u>(.*?)</u>$(?i)", tripperson) if mul: tripperson = mul.group(1).strip() @@ -183,9 +184,6 @@ def Parseloghtmltxt(year, expedition, txt): continue tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups() ldate = ParseDate(tripdate.strip(), year) - #assert tripid[:-1] == "t" + tripdate, (tripid, tripdate) - #trippeople = re.sub(r"Ol(?!l)", "Olly", trippeople) - #trippeople = re.sub(r"Wook(?!e)", "Wookey", trippeople) triptitles = triptitle.split(" - ") if len(triptitles) >= 2: tripcave = triptitles[0] diff --git a/parsers/survex.py b/parsers/survex.py index d542c09..01f6d21 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -178,7 +178,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines): print('QM res station %s' % qm_resolve_station) print('QM notes %s' % qm_notes) - # If the QM isn't resolved (has a resolving station) thn load it + # If the QM isn't resolved (has a resolving station) then load it if not qm_resolve_section or qm_resolve_section is not '-' or qm_resolve_section is not 'None': from_section = models.SurvexBlock.objects.filter(name=qm_from_section) # If we can find a section (survex note chunck, named) diff --git a/templates/cave.html b/templates/cave.html index 1ba898e..9fbca0d 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -220,7 +220,7 @@ div.linear-scale-caption { } #frame .tab { position: absolute; - right: 0px;lass="cavedisplay" + right: 0px; width: 40px; height: 40px; box-sizing: border-box; @@ -421,7 +421,7 @@ div#scene { CV.UI.init( 'scene', { home: '/javascript/CaveView/', surveyDirectory: '/cave/3d/', - terrainDirectory: '/loser/surface/terrain/' + terrainDirectory: '/loser/surface/terrain/' } ); // load a single survey to display @@ -516,7 +516,10 @@ div#scene { {% if ent.entrance.exact_station %} <dt>Exact Station</dt><dd>{{ ent.entrance.exact_station|safe }} {{ ent.entrance.exact_location.y|safe }}, {{ ent.entrance.exact_location.x|safe }}, {{ ent.entrance.exact_location.z|safe }}m</dd> {% endif %} - {% if ent.entrance.other_station %} + {% if ent.entrance.find_location %} + <dt>Coordinates</dt><dd>{{ ent.entrance.find_location|safe }}</dd> + {% endif %} + {% if ent.entrance.other_station %} <dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }} {% if ent.entrance.other_description %} - {{ ent.entrance.other_description|safe }} |