diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-05-02 14:50:46 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-05-02 14:50:46 +0100 |
commit | a9ffae9b87b001ecd2f5fbc626d3c782548acf94 (patch) | |
tree | e761e9210addda9a170579c25e9bf712b941d159 /core/views/logbooks.py | |
parent | 3393db0fbc69556ad09a18b840b6cf10eaf4f52c (diff) | |
download | troggle-a9ffae9b87b001ecd2f5fbc626d3c782548acf94.tar.gz troggle-a9ffae9b87b001ecd2f5fbc626d3c782548acf94.tar.bz2 troggle-a9ffae9b87b001ecd2f5fbc626d3c782548acf94.zip |
Fix images in single logbook entries
Diffstat (limited to 'core/views/logbooks.py')
-rw-r--r-- | core/views/logbooks.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 2ec6991..fe78cb6 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -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}" ') |