summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-03-01 22:13:46 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2025-03-01 22:13:46 +0000
commit71c3fb12ab21c952311d6220c94fc876300659fd (patch)
treeca6e4049642376ea95ff34b6a22d8b85dc573ab2
parent4e9c766493150e0bd62d25c1e013ccdf4e117e5f (diff)
downloadtroggle-71c3fb12ab21c952311d6220c94fc876300659fd.tar.gz
troggle-71c3fb12ab21c952311d6220c94fc876300659fd.tar.bz2
troggle-71c3fb12ab21c952311d6220c94fc876300659fd.zip
new report for Lost entrances
-rw-r--r--core/models/caves.py3
-rw-r--r--core/views/caves.py25
-rw-r--r--templates/entrancetags.html59
-rw-r--r--urls.py2
4 files changed, 88 insertions, 1 deletions
diff --git a/core/models/caves.py b/core/models/caves.py
index 35b07f2..45a7b5e 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -266,6 +266,9 @@ class Entrance(TroggleModel):
def __str__(self):
return str(self.slug)
+
+ def name(self):
+ return str(self.slug)[5:]
def single(self, station):
if not station:
diff --git a/core/views/caves.py b/core/views/caves.py
index ccea4dc..7272cb5 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -167,7 +167,10 @@ def padnumber(x):
def numericalcmp(x, y):
return cmp(padnumber(x), padnumber(y))
-
+def entKey(e):
+ k = caveKey(e.firstcave())
+ return k
+
def caveKey(c):
"""This function goes into a lexicographic sort function, and the values are strings,
but we want to sort numerically on kataster number before sorting on unofficial number.
@@ -239,6 +242,26 @@ def entranceindex(request):
{"entrances": ents},
)
+def entrancetags(request):
+ ents = list(Entrance.objects.all())
+ ents1623 = []
+ for e in ents:
+ if e.slug[:4] == "1623":
+ if e.firstcave().kataster_number:
+ if int(e.firstcave().kataster_number) < 35:
+ continue
+ if e.best_station():
+ continue
+ if e.findability != "S": # it says we do not have coordinates
+ ents1623.append(e)
+ ents1623.sort(key=entKey)
+
+ return render(
+ request,
+ "entrancetags.html",
+ {"entrances": ents1623},
+ )
+
def cave3d(request, cave_id=""):
"""This is used to create a download url in templates/cave.html if anyone wants to download the .3d file
diff --git a/templates/entrancetags.html b/templates/entrancetags.html
new file mode 100644
index 0000000..7f1fc42
--- /dev/null
+++ b/templates/entrancetags.html
@@ -0,0 +1,59 @@
+{% extends "cavebase.html" %}
+
+
+{% block title %}Entrance Tag Status{% endblock %}
+
+{% block content %}
+<style>
+table, th, td {
+ border: 1px solid black;
+ border-collapse: collapse;
+}
+</style>
+<h1>Entrance Tag Status</h1>
+<p>
+This list excludes those entrances with valid coordinates (which may or may not have tags), irrespective of the "findability" value. <br />
+[Many entrances have out-dated settings for "findability".]
+<h2>1623</h2>
+<table>
+<theader>
+<tr><th width="16">Entrance</th><th width="16">Cave</th><th width="2">Find..</th><th width="2">Mark</th><th width="40%">Marking & <em>Location</em></th></tr>
+</theader>
+<tbody>
+<ul>
+{% for entrance in entrances %}
+<tr><td>
+{% if entrance.best_station %}
+<a href="/stations#{{ entrance.best_station }}">{% endif %}
+{{ entrance.name }}</a></td>
+<td>{% for cave in entrance.cavelist %}<a href="{{ cave.url }}">{{ cave.number }}</a>{% endfor %}</td>
+
+<td>{% if entrance.findability%}
+{% if entrance.lat %}<a href="{{ entrance.firstcave.url }}">{% endif %}
+
+{{ entrance.get_findability_display}}</a>
+
+{% endif %}
+</td>
+<td id="{{ entrance.best_station }}">
+{% if entrance.marking%}
+<a href="https://www.openstreetmap.org/?mlat={{ entrance.lat|floatformat:7}}&mlon={{entrance.long|floatformat:7}}">
+{{ entrance.get_marking_display }}</a>
+{% endif %}
+</td>
+
+<td>
+<font color="blue"> {{ entrance.firstcave.official_name|safe }}</font><br />
+{% if entrance.marking_comment%}{{ entrance.marking_comment|safe }}<br />{% endif %}
+<em>
+{{ entrance.location_description|safe }}</em>
+</td>
+
+</tr>
+{% endfor %}
+</tbody>
+</ul>
+
+
+
+{% endblock %}
diff --git a/urls.py b/urls.py
index 38bc944..5dcad03 100644
--- a/urls.py
+++ b/urls.py
@@ -18,6 +18,7 @@ from troggle.core.views.caves import (
edit_cave,
edit_entrance,
entranceindex,
+ entrancetags,
expo_kml,
expo_kmz,
get_entrances,
@@ -157,6 +158,7 @@ trogglepatterns = [
path('caveslist', caveslist, name="caveslist"),
path('entrances', entranceindex, name="entranceindex"),
+ path('enttags', entrancetags, name="entrancetags"),
re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
path('admin/', admin.site.urls), # includes admin login & logout urls & /admin/jsi18n/ NOTE TERMINAL SLASH