mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 16:51:54 +00:00
Fix images in single logbook entries
This commit is contained in:
parent
3393db0fbc
commit
a9ffae9b87
@ -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}" ')
|
||||
|
@ -57,13 +57,16 @@ def parseCaveQMs(cave,inputFile):
|
||||
qmCSVContents.seek(0,0)
|
||||
qmReader = csv.reader(qmCSVContents,dialect=dialect)
|
||||
next(qmReader) # Skip header row
|
||||
n = 0
|
||||
for line in qmReader:
|
||||
try:
|
||||
n += 1
|
||||
year=int(line[0][1:5])
|
||||
logslug = f'PH_{int(year)}_{int(n):02d}'
|
||||
#check if placeholder exists for given year, create it if not
|
||||
message = " ! - "+ str(year) + " logbook: placeholder entry for '" + cave + "' created. Should be re-attached to the actual trip."
|
||||
if cave=='204-steinBH':
|
||||
placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="204", title="placeholder for QMs in 204", text=message, defaults={"date": date(year, 1, 1),"cave_slug":str(steinBr)})
|
||||
placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="204", title="placeholder for QMs in 204", text=message, defaults={"date": date(year, 1, 1),"cave_slug":str(steinBr), "slug": logslug})
|
||||
elif cave=='234-Hauch':
|
||||
placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="234", title="placeholder for QMs in 234", text=message, defaults={"date": date(year, 1, 1),"cave_slug":str(hauchHl)})
|
||||
# if hadToCreate:
|
||||
|
@ -59,7 +59,7 @@ trips ={}
|
||||
# the logbook loading section
|
||||
#
|
||||
def set_trip_id(year, seq):
|
||||
tid= f"{year}.s{seq:02d}"
|
||||
tid= f"{year}_s{seq:02d}"
|
||||
return tid
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
|
||||
# but it is a db query which we should try to avoid - rewrite this
|
||||
|
||||
#NEW slug for a logbook entry here! Use the unique id, not the title !!!
|
||||
slug = tid + "." + slugify(title)[:10]
|
||||
slug = tid + "_" + slugify(title)[:10].replace('-','_')
|
||||
nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave_slug':str(cave), 'slug': slug, 'entry_type':entry_type}
|
||||
lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user