From 2f7354d556b4fa52b426e1573ffc6178c2b5f971 Mon Sep 17 00:00:00 2001
From: Philip Sargent
Date: Thu, 24 Jul 2025 15:02:33 +0200
Subject: [PATCH] this year's cave list
---
core/views/caves.py | 17 ++++++++++
templates/caveindex.html | 68 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+)
diff --git a/core/views/caves.py b/core/views/caves.py
index 3a533c1a6..df6d4fc8a 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -222,6 +222,21 @@ def caveindex(request):
caves1624.sort(key=caveKey)
caves1626.sort(key=caveKey)
caves1627.sort(key=caveKey)
+
+ allcaves = caves1623 + caves1624 + caves1626 + caves1627
+ 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)
+
return render(
request,
"caveindex.html",
@@ -230,6 +245,8 @@ def caveindex(request):
"caves1627": caves1627,
"caves1624": caves1624,
"notablecaves": getnotablecaves(),
+ "caves_this_year": caves_this_year,
+ "caves_last_year": caves_last_year,
"cavepage": True, "year": current_expo()},
)
diff --git a/templates/caveindex.html b/templates/caveindex.html
index 758353495..bb6fff188 100644
--- a/templates/caveindex.html
+++ b/templates/caveindex.html
@@ -34,6 +34,74 @@ Black triangle ▲ against a name indicat
Cave Number Index - kept updated
+This year's caves
+
+
+{% for cave in caves_this_year %}
+ |
+ {% if cave.kataster_number %}
+ {{ cave.kataster_number }} {{cave.official_name|safe}}
+ {% if cave.unofficial_number %}
+ ({{cave.unofficial_number }})
+ {% endif %}
+ {% else %}
+ {{cave.unofficial_number }} {{cave.official_name|safe}}
+ {% endif %}
+ {% if cave.filename %}
+ {% if cave.entrances %}
+ {% if cave.no_location %}▲{% endif %}
+ {% else %}▲
+ {% endif %}
+ {% else %}▼
+ {% endif %}
+ {% if cave.survex_file %}{% else %}
+ {% if cave.fully_explored %}
+ *
+ {% else %}
+ *
+ {% endif %}
+
+ {% endif %}
+ |
+
+{% endfor %}
+
+
+
+Last year's caves
+
+
+{% for cave in caves_last_year %}
+ |
+ {% if cave.kataster_number %}
+ {{ cave.kataster_number }} {{cave.official_name|safe}}
+ {% if cave.unofficial_number %}
+ ({{cave.unofficial_number }})
+ {% endif %}
+ {% else %}
+ {{cave.unofficial_number }} {{cave.official_name|safe}}
+ {% endif %}
+ {% if cave.filename %}
+ {% if cave.entrances %}
+ {% if cave.no_location %}▲{% endif %}
+ {% else %}▲
+ {% endif %}
+ {% else %}▼
+ {% endif %}
+ {% if cave.survex_file %}{% else %}
+ {% if cave.fully_explored %}
+ *
+ {% else %}
+ *
+ {% endif %}
+
+ {% endif %}
+ |
+
+{% endfor %}
+
+
+
1623