Add list of entrances

This commit is contained in:
Martin Green 2023-07-03 08:00:03 +01:00
parent e4fe5eaf5d
commit b91223da66
3 changed files with 38 additions and 2 deletions

View File

@ -124,7 +124,7 @@ def getnotablecaves():
def caveindex(request): def caveindex(request):
Cave.objects.all() #Cave.objects.all()
caves1623 = list(Cave.objects.filter(area__short_name="1623")) caves1623 = list(Cave.objects.filter(area__short_name="1623"))
caves1626 = list(Cave.objects.filter(area__short_name="1626")) caves1626 = list(Cave.objects.filter(area__short_name="1626"))
caves1627 = list(Cave.objects.filter(area__short_name="1627")) caves1627 = list(Cave.objects.filter(area__short_name="1627"))
@ -137,6 +137,16 @@ def caveindex(request):
{"caves1623": caves1623, "caves1626": caves1626, "caves1627": caves1627, "notablecaves": getnotablecaves(), "cavepage": True}, {"caves1623": caves1623, "caves1626": caves1626, "caves1627": caves1627, "notablecaves": getnotablecaves(), "cavepage": True},
) )
def entranceindex(request):
ents = Entrance.objects.all()
return render(
request,
"entranceindex.html",
{"entrances": ents},
)
def cave3d(request, cave_id=""): 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 """This is used to create a download url in templates/cave.html if anyone wants to download the .3d file

View File

@ -0,0 +1,24 @@
{% extends "cavebase.html" %}
{% block title %}Entrance Index{% endblock %}
{% block content %}
<h1>Entrance Index</h1>
<table>
<theader>
<tr><th>Name</th><th>Point</th><th>Position</th>tr>
</theader>
<tbody>
<ul>
{% for entrance in entrances %}
<tr><td>{{ entrance }}</td><td>{{ entrance.best_station }}</td><td>{{ entrance.latlong }}</td></tr>
{% endfor %}
</tbody>
</ul>
{% endblock %}

View File

@ -6,7 +6,7 @@ from django.conf.urls.static import static
from troggle.core.views import statistics, survex from troggle.core.views import statistics, survex
from troggle.core.views.auth import expologin, expologout from troggle.core.views.auth import expologin, expologout
from troggle.core.views.caves import (cave3d, caveEntrance, caveindex, from troggle.core.views.caves import (cave3d, caveEntrance, caveindex, entranceindex,
cavepage, caveQMs, edit_cave, cave_debug, cavepage, caveQMs, edit_cave, cave_debug,
edit_entrance, get_entrances, qm, expo_kml, expo_kmz) edit_entrance, get_entrances, qm, expo_kml, expo_kmz)
from troggle.core.views.drawings import dwgallfiles, dwgfilesingle from troggle.core.views.drawings import dwgallfiles, dwgfilesingle
@ -95,6 +95,8 @@ trogglepatterns = [
re_path(r'^indxal.htm$', caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files re_path(r'^indxal.htm$', caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files
re_path(r'^people/?$', notablepersons, name="notablepersons"), re_path(r'^people/?$', notablepersons, name="notablepersons"),
re_path(r'^entrances$', entranceindex, name="entranceindex"),
re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/). re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
re_path(r'^admin/', admin.site.urls), # includes admin login & logout urls & /admin/jsi18n/ re_path(r'^admin/', admin.site.urls), # includes admin login & logout urls & /admin/jsi18n/