mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-21 23:01:52 +00:00
Entrance locations new report - url to cave
This commit is contained in:
parent
1ff723554c
commit
8c5fdf5021
@ -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:
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user