summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-01-15 20:21:49 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2025-01-15 20:21:49 +0000
commitc5b08ce80f6ea17556bbc45844706c94a9b542e9 (patch)
tree994017f7ade798c7388fc98213395cf3ea29a8d4 /core
parentf3bd9024cfdc1e4ff6b7a4cabc5fc2ddaea2baad (diff)
downloadtroggle-c5b08ce80f6ea17556bbc45844706c94a9b542e9.tar.gz
troggle-c5b08ce80f6ea17556bbc45844706c94a9b542e9.tar.bz2
troggle-c5b08ce80f6ea17556bbc45844706c94a9b542e9.zip
stumbled on bug when no entries in logbook, fixed.
Diffstat (limited to 'core')
-rw-r--r--core/models/logbooks.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/models/logbooks.py b/core/models/logbooks.py
index 8c8edbc..fd6bbfe 100644
--- a/core/models/logbooks.py
+++ b/core/models/logbooks.py
@@ -57,14 +57,16 @@ class LogbookEntry(TroggleModel):
<div class="trippeople">{% for personlogentry in logbook_entry.personlogentry_set.all %}{% if personlogentry.is_logbook_entry_author %}<u>{% if personlogentry.nickname_used %}{{personlogentry.nickname_used|safe}}{% else %}{{personlogentry.personexpedition.person|safe}}{% endif %}</u>,{% endif %}{% endfor %}{% for personlogentry in logbook_entry.personlogentry_set.all %}{% if personlogentry.is_logbook_entry_author %}{% else %}{% if personlogentry.nickname_used %}{{personlogentry.nickname_used|safe}}{% else %}{{personlogentry.personexpedition.person|safe}}{% endif %},{% endif %}{% endfor %}{% if logbook_entry.other_people %}, {{logbook_entry.other_people}}{% endif %}</div>
'''
- author = (
+ if author := (
PersonLogEntry.objects.filter(logbook_entry=self, is_logbook_entry_author=True)
.first()
- )
- if author.nickname_used:
- expoer = author.nickname_used
+ ):
+ if author.nickname_used:
+ expoer = author.nickname_used
+ else:
+ expoer = author.personexpedition.person.name()
else:
- expoer = author.personexpedition.person.name()
+ expoer = "nobody"
names = f"<u>{expoer}</u>"
participants = (
@@ -119,7 +121,7 @@ def writelogbook(year, filename):
t = loader.get_template("logbook2005style.html")
logbookfile = t.render({"logbook_entries": logbook_entries})
except:
- print(" ! Very Bad Error RENDERING template " + template)
+ print(" ! Very Bad Error RENDERING template ", t)
raise
# print(" - template rendered")
try: