mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 11:37:08 +00:00
Shorter, faster default caves index list
This commit is contained in:
@@ -205,8 +205,48 @@ def getnotablecaves():
|
||||
print(notablecaves)
|
||||
return notablecaves
|
||||
|
||||
|
||||
def caveindex(request):
|
||||
caves1623 = list(Cave.objects.filter(areacode="1623"))
|
||||
caves1626 = list(Cave.objects.filter(areacode="1626"))
|
||||
caves1623.sort(key=caveKey)
|
||||
caves1626.sort(key=caveKey)
|
||||
|
||||
allcaves = caves1623 + caves1626
|
||||
caves_this_year = []
|
||||
for c in allcaves:
|
||||
if c.unofficial_number.startswith(current_expo()):
|
||||
caves_this_year.append(c)
|
||||
caves_this_year.sort(key=caveKey)
|
||||
|
||||
caves_last_year = []
|
||||
for c in allcaves:
|
||||
last_year = str(int(current_expo()) - 1)
|
||||
if c.unofficial_number.startswith(last_year):
|
||||
caves_last_year.append(c)
|
||||
caves_this_year.sort(key=caveKey)
|
||||
|
||||
caves_previous_year = []
|
||||
for c in allcaves:
|
||||
previous_year = str(int(current_expo()) - 2)
|
||||
if c.unofficial_number.startswith(previous_year):
|
||||
caves_previous_year.append(c)
|
||||
caves_previous_year.sort(key=caveKey)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"caveindex.html",
|
||||
{"caves1623": caves1623,
|
||||
"caves1626": caves1626,
|
||||
"caves1627": "",
|
||||
"caves1624": "",
|
||||
"notablecaves": getnotablecaves(),
|
||||
"caves_this_year": caves_this_year,
|
||||
"caves_last_year": caves_last_year,
|
||||
"caves_previous_year": caves_previous_year,
|
||||
"cavepage": True, "year": current_expo()},
|
||||
)
|
||||
|
||||
def cavesall(request):
|
||||
"""Should use Django order-by for lazy sorting, not here. But only after we have a proper slug system in place for Caves
|
||||
"""
|
||||
# allcaves = Cave.objects.all()
|
||||
@@ -230,23 +270,15 @@ def caveindex(request):
|
||||
caves_this_year.append(c)
|
||||
caves_this_year.sort(key=caveKey)
|
||||
|
||||
caves_last_year = []
|
||||
for c in allcaves:
|
||||
last_year = str(int(current_expo()) - 1)
|
||||
if c.unofficial_number.startswith(last_year):
|
||||
caves_last_year.append(c)
|
||||
caves_this_year.sort(key=caveKey)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"caveindex.html",
|
||||
"cavesallindex.html",
|
||||
{"caves1623": caves1623,
|
||||
"caves1626": caves1626,
|
||||
"caves1627": caves1627,
|
||||
"caves1624": caves1624,
|
||||
"notablecaves": getnotablecaves(),
|
||||
"caves_this_year": caves_this_year,
|
||||
"caves_last_year": caves_last_year,
|
||||
"cavepage": True, "year": current_expo()},
|
||||
)
|
||||
|
||||
|
||||
5
templates/cave_red_star.html
Normal file
5
templates/cave_red_star.html
Normal file
@@ -0,0 +1,5 @@
|
||||
Red star <span style="color: red">*</span> against a name indicates that no survex file is explicitly associated with the cave<br />
|
||||
Blue star <span style="color: blue">*</span> against a name indicates that no survex file is explicitly associated with the cave but it is marked as 'fully explored'<br />
|
||||
Blue triangle <span style="color: #43C6DB">▼</span> against a name indicates that the cave is 'pending' creation properly.<br />
|
||||
Orange triangle <span style="color: orange">▲</span> against a name indicates that the cave has no Entrance (and is not 'pending').<br />
|
||||
Black triangle <span style="color: black">▲</span> against a name indicates that the cave has an Entrance, but no entrances have valid located survey stations.
|
||||
@@ -1,10 +1,10 @@
|
||||
{% extends "cavebase.html" %}
|
||||
|
||||
{% block title %}Cave Index{% endblock %}
|
||||
{% block title %}Recent Caves Index{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Cave Index</h1>
|
||||
<h1>Recent Caves Index</h1>
|
||||
<h3>Notable caves</h3>
|
||||
<ul>
|
||||
{% for cave in notablecaves %}
|
||||
@@ -20,11 +20,9 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Red star <span style="color: red">*</span> against a name indicates that no survex file is explicitly associated with the cave<br />
|
||||
Blue star <span style="color: blue">*</span> against a name indicates that no survex file is explicitly associated with the cave but it is marked as 'fully explored'<br />
|
||||
Blue triangle <span style="color: #43C6DB">▼</span> against a name indicates that the cave is 'pending' creation properly.<br />
|
||||
Orange triangle <span style="color: orange">▲</span> against a name indicates that the cave has no Entrance (and is not 'pending').<br />
|
||||
Black triangle <span style="color: black">▲</span> against a name indicates that the cave has an Entrance, but no entrances have valid located survey stations.
|
||||
{% include 'cave_red_star.html' %}
|
||||
<p>
|
||||
See <em><a href="/cavesall">All Caves</a></em> for all the caves in areas 1623, 1626, 1624, 1627
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
@@ -51,59 +49,16 @@ Black triangle <span style="color: black">▲</span> against a name indicat
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h3>1623</h3>
|
||||
<h3>Previous year's caves</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1623 %}
|
||||
{% for cave in caves_previous_year %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
|
||||
<h3>1626</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1626 %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
|
||||
|
||||
<h3>1627</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1627 %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
|
||||
<h3>1624</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1624 %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<p>
|
||||
See <em><a href="/cavesall">All Caves</a></em> for all the caves in areas 1623, 1626, 1624, 1627
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
|
||||
110
templates/cavesallindex.html
Normal file
110
templates/cavesallindex.html
Normal file
@@ -0,0 +1,110 @@
|
||||
{% extends "cavebase.html" %}
|
||||
|
||||
{% block title %}Cave Index{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Cave Index</h1>
|
||||
<h3>Notable caves</h3>
|
||||
<ul>
|
||||
{% for cave in notablecaves %}
|
||||
<li> {{ cave.areacode }} <a href="/{{ cave.url }}">
|
||||
{% if cave.kataster_number %}
|
||||
{{ cave.kataster_number }} <em>{{cave.official_name|safe}}</em></a>
|
||||
{% if cave.unofficial_number %}
|
||||
({{cave.unofficial_number }})
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{cave.unofficial_number }} <em>{{cave.official_name|safe}}</em></a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% include 'cave_red_star.html' %}
|
||||
|
||||
<p>Go to <a href="/caves">Recent Caves</a> for a shorter list of recent caves.
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h3>This year's caves</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves_this_year %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h3>Last year's caves</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves_last_year %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h3>1623</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1623 %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
|
||||
<h3>1626</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1626 %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
|
||||
|
||||
<h3>1627</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1627 %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
|
||||
<h3>1624</h3>
|
||||
<div style="column-count: 3;">
|
||||
<table class="searchable">
|
||||
{% for cave in caves1624 %}
|
||||
{% include 'cavelist_columns.html' %}
|
||||
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<p style="text-align:right">
|
||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
2
urls.py
2
urls.py
@@ -11,6 +11,7 @@ from troggle.core.views.caves import (
|
||||
cave3d,
|
||||
cave_debug,
|
||||
caveindex,
|
||||
cavesall,
|
||||
cavepage,
|
||||
caveQMs,
|
||||
caveslist,
|
||||
@@ -157,6 +158,7 @@ trogglepatterns = [
|
||||
path('people_ids', people_ids, name="people_ids"),
|
||||
path('folk_export', folk_export, name="folk_export"),
|
||||
path('caveslist', caveslist, name="caveslist"),
|
||||
path('cavesall', cavesall, name="cavesall"),
|
||||
|
||||
path('entrances', entranceindex, name="entranceindex"),
|
||||
path('enttags', entrancetags, name="entrancetags"),
|
||||
|
||||
Reference in New Issue
Block a user