2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 05:55:06 +00:00

Fix images in single logbook entries

This commit is contained in:
Philip Sargent
2021-05-02 14:50:46 +01:00
parent 3393db0fbc
commit a9ffae9b87
3 changed files with 14 additions and 3 deletions

View File

@@ -187,6 +187,14 @@ def logbookentry(request, date, slug):
return render(request, 'object_list.html',{'object_list':this_logbookentry})
else:
this_logbookentry=this_logbookentry[0]
y = str(this_logbookentry.date)[:4]
fix = f'src="/years/{y}/'
print(f'LOGBOOK ENTRY {this_logbookentry.date} /years/{y}')
this_logbookentry.text = this_logbookentry.text.replace('src="', fix )
this_logbookentry.text = this_logbookentry.text.replace("src='", f"src='/years/{y}/" )
print(this_logbookentry.text)
this_logbookentry.save()
return render(request, 'logbookentry.html', {'logbookentry': this_logbookentry})
else:
msg =(f' Logbook entry slug:"{slug}" not found in database on date:"{date}" ')