Update web/core/views.py
This commit is contained in:
parent
4e318df4d1
commit
46ba9079d9
@ -66,6 +66,18 @@ def entry_context(entry, result_ids):
|
||||
scripture_list = [
|
||||
t.strip() for t in (entry.scripture_raw or "").split(";") if t.strip()
|
||||
]
|
||||
|
||||
# NEW: compute talk PDF URL if present and the file exists
|
||||
talk_pdf_url = None
|
||||
try:
|
||||
if entry.talk_number:
|
||||
filename = f"talk_pdfs/S-34_E_{int(entry.talk_number):03d}.pdf"
|
||||
if staticfiles_storage.exists(filename):
|
||||
talk_pdf_url = staticfiles_storage.url(filename)
|
||||
except Exception:
|
||||
# fail gracefully; leave talk_pdf_url as None
|
||||
pass
|
||||
|
||||
return {
|
||||
"entry": entry,
|
||||
"locked": True,
|
||||
@ -73,6 +85,8 @@ def entry_context(entry, result_ids):
|
||||
"count": count,
|
||||
"subject_list": subject_list,
|
||||
"scripture_list": scripture_list,
|
||||
# NEW
|
||||
"talk_pdf_url": talk_pdf_url,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user