summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/forms.py4
-rw-r--r--core/models/caves.py16
-rw-r--r--core/models/wallets.py11
-rw-r--r--parsers/logbooks.py2
-rw-r--r--parsers/people.py2
-rw-r--r--templates/logbook2005style.html11
6 files changed, 29 insertions, 17 deletions
diff --git a/core/forms.py b/core/forms.py
index 0bcd6ef..b9a8c1f 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -149,6 +149,10 @@ class CaveForm(ModelForm):
# self._errors["url"] = self.error_class(["This field is required."])
# if cleaned_data.get("url") and cleaned_data.get("url").startswith("/"):
# self._errors["url"] = self.error_class(["This field cannot start with a /."])
+ if self.data.get("areacode") == "":
+ self._errors["areacode"] = self.error_class(
+ ["An areacode, e.g. 1623, is required."]
+ )
return cleaned_data
diff --git a/core/models/caves.py b/core/models/caves.py
index 45a7b5e..2914e1e 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -53,18 +53,10 @@ class CaveAndEntrance(models.Model):
def get_cave_leniently(caveid):
- try:
- c = getCave(caveid)
- if c:
- return c
- except:
- # print(f"get_cave_leniently FAIL {caveid}")
- try:
- c = getCave("1623-"+caveid)
- if c:
- return c
- except:
- return None
+ Gcavelookup = GetCaveLookup()
+ if caveid in Gcavelookup:
+ return Gcavelookup[caveid]
+
class Cave(TroggleModel):
# (far) too much here perhaps,
diff --git a/core/models/wallets.py b/core/models/wallets.py
index 288608a..d9a140d 100644
--- a/core/models/wallets.py
+++ b/core/models/wallets.py
@@ -245,13 +245,20 @@ class Wallet(models.Model):
return None
#cavelist = jsondata["cave"]
cavelist = Wallet.input_to_list(jsondata["cave"])
+ from troggle.core.models.troggle import DataIssue
for i in cavelist:
+ if not i:
+ continue
try:
- caveobject = get_cave_leniently(i)
+ caveobject = get_cave_leniently(i.strip())
+ # print(f"Attempting adding cave '{caveobject}' to wallet {self} ")
if caveobject:
self.caves.add(caveobject)
except:
- print(f"FAIL adding cave to wallet.caves '{i}'")
+ message = f"FAIL adding cave {caveobject} to wallet.caves '{i}'"
+
+ DataIssue.objects.update_or_create(parser="wallets", message=message, url=wurl)
+ print(message)
pass
def year(self):
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index b53756b..3ae1a11 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -58,7 +58,7 @@ LOGBOOK_PARSER_SETTINGS = {
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
ENTRIES = {
- "2025": 1,
+ "2025": 27,
"2024": 127,
"2023": 131,
"2022": 94,
diff --git a/parsers/people.py b/parsers/people.py
index 0a05efb..5426683 100644
--- a/parsers/people.py
+++ b/parsers/people.py
@@ -188,7 +188,7 @@ def check_new_signups(expedition):
signups_clear = read_signups()
# print(signups_clear)
for slug in signups_clear:
- print(slug)
+ print(f"check_new_signups: {slug}")
p = Person.objects.get(slug=slug)
pe = PersonExpedition.objects.update_or_create(person=p, expedition=expedition)
# print("ADDING ",pe, expedition)
diff --git a/templates/logbook2005style.html b/templates/logbook2005style.html
index 668ea9d..0956d81 100644
--- a/templates/logbook2005style.html
+++ b/templates/logbook2005style.html
@@ -20,8 +20,12 @@ Exported on {% now 'Y-m-d H:m' %} using either the control panel webpage or when
See troggle/code/views/other.py and core.models/logbooks.py writelogbook(year, filename)
-->
<body>
-{%for logbook_entry in logbook_entries%}<hr />
+<button type="button" onclick="window.scrollTo(0, document.body.scrollHeight)" autofocus>Scroll To Bottom</button>
+<br/>
+<a href="/logbookedit/">Add Log book entry</a>
+
+{%for logbook_entry in logbook_entries%} <hr />
<div class="tripdate" id="{{logbook_entry.slug}}">{{logbook_entry.date|date:'Y-m-d'}}</div>
<div class="trippeople">{{logbook_entry.get_participants|safe}}</div>
<div class="triptitle">{{logbook_entry.title|safe}}</div>
@@ -29,5 +33,10 @@ See troggle/code/views/other.py and core.models/logbooks.py writelogbook(year, f
<div class="timeug">T/U: {{logbook_entry.time_underground|safe}} hours</div>
<div class="editentry"><br /><a href="/logbookedit/{{logbook_entry.slug}}">Edit this entry</a><br /></div>
{% endfor %}<hr />
+
+<button type="button" onclick="window.scrollTo(0, 0)" autofocus>Scroll To Top</button>
+<br/>
+<a href="/logbookedit/">Add Log book entry</a>
+
</body>
</html>