2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 14:51:51 +00:00

fixing ,, bug in logbook rewriting, and fixing persons order

This commit is contained in:
Philip Sargent 2024-07-30 00:53:24 +03:00
parent 526d0ad904
commit 62320e9f7e
4 changed files with 8 additions and 8 deletions

View File

@ -76,17 +76,17 @@ class LogbookEntry(TroggleModel):
return index
def writelogbook(year, filename):
"""Writes all the database logbook entries into a new logbook.html file
"""
current_expedition = Expedition.objects.get(year=year)
logbook_entries = LogbookEntry.objects.filter(expedition=current_expedition).order_by(
"slug"
) # now that slug, aka tripid, is in our standard date form, this will preserve ordering.
print(f" - Logbook to be exported has {len(logbook_entries)} entries in it.")
template = "logbook2005style.html"
try:
t = loader.get_template(template)
t = loader.get_template("logbook2005style.html")
logbookfile = t.render({"logbook_entries": logbook_entries})
except:
print(" ! Very Bad Error RENDERING template " + template)

View File

@ -161,7 +161,7 @@ class PersonExpedition(TroggleModel):
# is_guest = models.BooleanField(default=False) # This is per-Person, not per-PersonExpedition
class Meta:
ordering = ("-expedition",)
ordering = ("-expedition", "-person")
# order_with_respect_to = 'expedition'
def __str__(self):

View File

@ -59,11 +59,11 @@ LOGBOOK_PARSER_SETTINGS = {
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
ENTRIES = {
"2024": 41,
"2023": 112,
"2024": 69,
"2023": 131,
"2022": 94,
"2019": 55,
"2018": 95,
"2018": 98,
"2017": 74,
"2016": 87,
"2015": 80,

View File

@ -22,7 +22,7 @@ See troggle/code/views/other.py and core.models/logbooks.py writelogbook(year, f
<hr />
<div class="tripdate" id="{{logbook_entry.slug}}">{{logbook_entry.date|date:'Y-m-d'}}</div>
<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>
<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>
<div class="triptitle">{{logbook_entry.title|safe}}</div>
{{logbook_entry.text|safe}}
<div class="timeug">T/U: {{logbook_entry.time_underground|safe}} hours</div>