summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-05-07 23:21:57 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-05-07 23:21:57 +0100
commit8c5fdf5021481bb9ea99fa6309ebc67a5c57f5b5 (patch)
tree124b6fe2de9d8d033ac0d68745ead89db99c5308
parent1ff723554cf46dc644a0fa2a295ef175bc43b4d5 (diff)
downloadtroggle-8c5fdf5021481bb9ea99fa6309ebc67a5c57f5b5.tar.gz
troggle-8c5fdf5021481bb9ea99fa6309ebc67a5c57f5b5.tar.bz2
troggle-8c5fdf5021481bb9ea99fa6309ebc67a5c57f5b5.zip
Entrance locations new report - url to cave
-rw-r--r--core/forms.py2
-rw-r--r--core/models/caves.py21
-rw-r--r--templates/eastings.html9
3 files changed, 24 insertions, 8 deletions
diff --git a/core/forms.py b/core/forms.py
index 896a655..a2727f8 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -81,6 +81,8 @@ class EntranceForm(ModelForm):
exact_station = forms.CharField(required=False)
northing = forms.CharField(required=False)
easting = forms.CharField(required=False)
+ lat_wgs84 = forms.CharField(required=False, widget=forms.TextInput(attrs={'size': '10'}), label="Latitude (WSG84)")
+ long_wgs84 = forms.CharField(required=False, widget=forms.TextInput(attrs={'size': '10'}), label="Longitude (WSG84)")
alt = forms.CharField(required=False, label="Altitude (m)")
url = forms.CharField(required = False, label="URL [usually blank]", widget=forms.TextInput(attrs={'size': '45'}))
class Meta:
diff --git a/core/models/caves.py b/core/models/caves.py
index fb62a26..5f68e77 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -347,11 +347,13 @@ class Entrance(TroggleModel):
return self.findability != "S" or not self.has_photo or self.marking != "T"
def get_absolute_url(self):
- ancestor_titles='/'.join([subcave.title for subcave in self.get_ancestors()])
- if ancestor_titles:
- res = '/'.join((self.get_root().cave.get_absolute_url(), ancestor_titles, self.title))
- else:
- res = '/'.join((self.get_root().cave.get_absolute_url(), self.title))
+ # ancestor_titles='/'.join([subcave.title for subcave in self.get_ancestors()])
+ # if ancestor_titles:
+ # res = '/'.join((self.get_root().cave.get_absolute_url(), ancestor_titles, self.title))
+ # else:
+ # res = '/'.join((self.get_root().cave.get_absolute_url(), self.title))
+ # return res
+ res = '/'.join((self.get_root().cave.get_absolute_url(), self.title))
return res
def slug(self):
@@ -367,6 +369,15 @@ class Entrance(TroggleModel):
self.save()
return self.cached_primary_slug
+ def cavelist(self):
+ rs = []
+ res = ""
+ for e in CaveAndEntrance.objects.filter(entrance=self):
+ if e.cave:
+ rs.append(e.cave)
+ return rs
+
+
def get_file_path(self):
return Path(settings.ENTRANCEDESCRIPTIONS, self.filename)
diff --git a/templates/eastings.html b/templates/eastings.html
index 92c69ba..40e72b6 100644
--- a/templates/eastings.html
+++ b/templates/eastings.html
@@ -6,18 +6,21 @@
<h1>Entrance locations</h1>
<p>
-This is work in progress (May 2021).
+These are all the locations specified in Northing/Easting coordinates in the system.
<table>
-<tr><th>Entrance</th><th>Easting</th><th>Northing</th><th>tag</th><th>tag exact</th><th>tag other</th></tr>
+<tr><th>Cave</th><th>Entrance</th><th>Easting</th><th>Northing</th><th>tag</th><th>tag exact</th><th>tag other</th><th>slug</th></tr>
{% for ent in ents %}
<tr>
- <td style="text-align:left"><a href="{{ ent.name }}">{{ent.name|safe}}</a></td>
+ <td style="text-align:left"><a href="/cave/{{ent.cached_primary_slug}}">
+ {% for c in ent.cavelist %}{{c.official_name|safe}}{% endfor %}</a></td>
+ <td style="text-align:left">{{ent.name|safe}}</td>
<td style="text-align:right">{{ent.easting|floatformat:2}}</td>
<td style="text-align:right">{{ent.northing|floatformat:2}}</td>
<td style="text-align:right">{{ent.tag_station}}</td>
<td style="text-align:right">{{ent.exact_station}}</td>
<td style="text-align:right">{{ent.other_station}}</td>
+ <td style="text-align:right">{{ent.slug}}</td>
</tr>
{% endfor %}
</table>