mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 13:18:15 +00:00
got author OK
This commit is contained in:
@@ -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}")
|
print(f"CANNOT write this file {filepath}. Exception dumping json. Ask a nerd to fix this: {e}")
|
||||||
raise 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
|
# 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.
|
# 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'))
|
jsondict = serialize("json", [le], fields=('slug', 'date', 'expedition', 'title', 'cave', 'place', 'other_people', 'time_underground', 'text'))
|
||||||
return jsondict
|
return jsondict
|
||||||
|
|
||||||
dirpath = settings.EXPOWEB / "years" / year / LOGBOOK_ENTRIES
|
dirpath = settings.EXPOWEB / "years" / year / LOGBOOK_ENTRIES
|
||||||
|
|
||||||
for le in entries:
|
for le in entries[:4]:
|
||||||
filename = f"{le.slug}-{le.pk:03}.json"
|
filename = f"{le.slug}-{le.pk:03}.json"
|
||||||
filepath = dirpath / filename
|
filepath = dirpath / filename
|
||||||
# description = f" {le.slug} :: {le.date} - {le.title}"
|
# description = f" {le.slug} :: {le.date} - {le.title}"
|
||||||
ensure_dir_exists(filepath)
|
ensure_dir_exists(filepath)
|
||||||
|
|
||||||
jsondict = serialize_logentry()
|
jsondict = serialize_logentry(le)
|
||||||
write_json_file()
|
write_json_file()
|
||||||
git_add(filename, dirpath)
|
git_add(filename, dirpath)
|
||||||
|
|
||||||
@@ -438,9 +446,6 @@ def write_entries(entries, year, editor):
|
|||||||
git_commit(dirpath, commit_msg, editor)
|
git_commit(dirpath, commit_msg, editor)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Gemini has the answer, get what I need from this:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def export_entry_with_author_details(request, entry_id):
|
def export_entry_with_author_details(request, entry_id):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user