mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
Survex directories report tidied
This commit is contained in:
parent
69340db438
commit
2c5ebde308
@ -297,14 +297,14 @@ def rendercave(request, cave, slug, cave_id=""):
|
||||
return r
|
||||
|
||||
|
||||
def cavepage(request, karea, subpath):
|
||||
def cavepage(request, karea=None, subpath=None, slug=None):
|
||||
"""Displays a cave description page
|
||||
accessed by kataster area number specifically
|
||||
OR
|
||||
accessed by cave.url specifically set in data, e.g.
|
||||
"1623/000/000" <= cave-data/1623-000.html
|
||||
"1623/41/115.htm" <= cave-data/1623-115.html
|
||||
so we have to query the database to fine the URL as we cannot rely on the url actually telling us the cave by inspection.
|
||||
so we have to query the database to find the URL as we cannot rely on the url actually telling us the cave by inspection.
|
||||
|
||||
NOTE that old caves have ".html" (or ".htm") in the URL as they used to be actual files. But since 2006 these URLs
|
||||
refer to virtual pages generated on the fly by troggle, so the".html" is confusing and redundant.
|
||||
@ -312,9 +312,17 @@ def cavepage(request, karea, subpath):
|
||||
There are also A LOT OF URLS to e.g. /1623/161/l/rl89a.htm which are IMAGES and real html files
|
||||
in cave descriptions. These need to be handled HERE too (accident of history).
|
||||
"""
|
||||
if slug:
|
||||
Gcavelookup = GetCaveLookup()
|
||||
if slug in Gcavelookup:
|
||||
cave = Gcavelookup[slug]
|
||||
return rendercave(request, cave, slug)
|
||||
else:
|
||||
message = f"Failed to find cave from identifier given: {slug}."
|
||||
return render(request, "errors/generic.html", {"message": message})
|
||||
|
||||
kpath = karea + subpath
|
||||
# print(f" ! cavepage:'{kpath}' kataster area:'{karea}' rest of path:'{subpath}'")
|
||||
|
||||
try:
|
||||
cave = Cave.objects.get(url=kpath) # ideally this will be unique
|
||||
except Cave.DoesNotExist:
|
||||
|
@ -4,29 +4,17 @@
|
||||
{% block content %}
|
||||
|
||||
{% autoescape off %}
|
||||
<h1>SurvexDirectory objects</h1>
|
||||
<h1>Survex Primary files: per Cave and per directory</h1>
|
||||
{% endautoescape %}
|
||||
|
||||
<h2>All SurvexDirectories</h2>
|
||||
<table>
|
||||
<tr><th>Dir Path</th><th>Primary svx</th></tr>
|
||||
{% for sd in survexdirs %}
|
||||
<tr>
|
||||
<td><span{% if sd.matchbad %} style="color:red" {% endif %}>{{sd.path}}</span></td>
|
||||
<td><a href="/survexfile/{{sd.primarysurvexfile}}.svx"><span {% if sd.pathbad %} style="color:red" {% endif %}>{{sd.primarysurvexfile}}.svx</span></a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<p>
|
||||
<h2>All SurvexFiles</h2>
|
||||
<table>
|
||||
<tr><th>Cave</th><th>f.survexdirectory.path</th><th>f.primary.path.parent()</th><th>f.primary</th><th>f.path</th></tr>
|
||||
<tr><th>Cave</th><th>Cave primary</th><th>f.primary</th><th>f.path</th></tr>
|
||||
{% for f in survexfiles %}
|
||||
<tr>
|
||||
<td>{{f.cave}}</td>
|
||||
<td><span {% if f.matchbad %} style="color:red" {% endif %}>{{f.survexdirectory.path}}</span></td>
|
||||
<td><span {% if f.primarybad %} style="color:red" {% endif %}>{{f.pathparent}}</span></td>
|
||||
<td> {{f.primary}}</td>
|
||||
<td><a href="/cave/{{f.cave}}">{{f.cave}}</a></td>
|
||||
<td>{{f.cave.survex_file}}</td>
|
||||
<td> {{f.primary}}.svx</td>
|
||||
<td><span {% if f.pathbad %} style="color:red" {% endif %}><a href="/survexfile/{{f.path}}.svx">{{f.path}}.svx</a></span></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
1
urls.py
1
urls.py
@ -141,6 +141,7 @@ trogglepatterns = [
|
||||
re_path(r'^getEntrances/(?P<caveslug>.*)', get_entrances, name = "get_entrances"), # used internally ?
|
||||
|
||||
# Cave description pages
|
||||
path('cave/<slug:slug>', cavepage, name="cavepage"),
|
||||
path('cave_debug', cave_debug, name="cave_debug"),
|
||||
re_path(r'^newcave/$', edit_cave, name="newcave"),
|
||||
re_path(r'^cave/3d/(?P<cave_id>[^/]+).3d$', cave3d, name="cave3d"),
|
||||
|
Loading…
Reference in New Issue
Block a user