2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 16:27:07 +00:00

got author OK

This commit is contained in:
2025-11-22 11:46:21 +02:00
parent 7889162420
commit 76fe0c0379

View File

@@ -416,21 +416,29 @@ def write_entries(entries, year, editor):
print(f"CANNOT write this file {filepath}. Exception dumping json. Ask a nerd to fix this: {e}")
raise e
def serialize_logentry():
def serialize_logentry(le):
# REPLACE this with hand-built serializer which includes .author, .who which were added to the entries but re not in the model Class directly
# see below for Gemini code to do that. Going to bed now.
author_link = PersonLogEntry.objects.select_related('personexpedition').get(
logbook_entry=le,
is_logbook_entry_author=True # Adjust filter based on your logic
)
author = author_link.personexpedition.person
print(author)
jsondict = serialize("json", [le], fields=('slug', 'date', 'expedition', 'title', 'cave', 'place', 'other_people', 'time_underground', 'text'))
return jsondict
dirpath = settings.EXPOWEB / "years" / year / LOGBOOK_ENTRIES
for le in entries:
for le in entries[:4]:
filename = f"{le.slug}-{le.pk:03}.json"
filepath = dirpath / filename
# description = f" {le.slug} :: {le.date} - {le.title}"
ensure_dir_exists(filepath)
jsondict = serialize_logentry()
jsondict = serialize_logentry(le)
write_json_file()
git_add(filename, dirpath)
@@ -438,9 +446,6 @@ def write_entries(entries, year, editor):
git_commit(dirpath, commit_msg, editor)
return True
# Gemini has the answer, get what I need from this:
def export_entry_with_author_details(request, entry_id):
try: