forked from expo/troggle
chnage img fix to import, not display
This commit is contained in:
parent
a9ffae9b87
commit
51da26564f
@ -187,14 +187,6 @@ def logbookentry(request, date, slug):
|
|||||||
return render(request, 'object_list.html',{'object_list':this_logbookentry})
|
return render(request, 'object_list.html',{'object_list':this_logbookentry})
|
||||||
else:
|
else:
|
||||||
this_logbookentry=this_logbookentry[0]
|
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})
|
return render(request, 'logbookentry.html', {'logbookentry': this_logbookentry})
|
||||||
else:
|
else:
|
||||||
msg =(f' Logbook entry slug:"{slug}" not found in database on date:"{date}" ')
|
msg =(f' Logbook entry slug:"{slug}" not found in database on date:"{date}" ')
|
||||||
|
@ -101,7 +101,7 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
|
|||||||
|
|
||||||
def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_underground, entry_type="wiki", tid=None):
|
def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_underground, entry_type="wiki", tid=None):
|
||||||
""" saves a logbook entry and related persontrips
|
""" saves a logbook entry and related persontrips
|
||||||
Does NOT save the expeditionday_id - all NULLs. why?
|
Does NOT save the expeditionday_id - all NULLs. why? Because we are deprecating expeditionday !
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground, tid=tid)
|
trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground, tid=tid)
|
||||||
@ -127,6 +127,10 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
|
|||||||
cave=None
|
cave=None
|
||||||
if lplace not in noncaveplaces:
|
if lplace not in noncaveplaces:
|
||||||
cave = GetCaveLookup().get(lplace)
|
cave = GetCaveLookup().get(lplace)
|
||||||
|
|
||||||
|
y = str(date)[:4]
|
||||||
|
text = text.replace('src="', f'src="/years/{y}/' )
|
||||||
|
text = text.replace("src='", f"src='/years/{y}/" )
|
||||||
|
|
||||||
#Check for an existing copy of the current entry, and save
|
#Check for an existing copy of the current entry, and save
|
||||||
expeditionday = expedition.get_expedition_day(date)
|
expeditionday = expedition.get_expedition_day(date)
|
||||||
@ -134,9 +138,10 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
|
|||||||
# 'cave' is converted to a string doing this, which renders as the cave slug.
|
# 'cave' is converted to a string doing this, which renders as the cave slug.
|
||||||
# but it is a db query which we should try to avoid - rewrite this
|
# 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 !!!
|
#NEW slug for a logbook entry here! Unique id + slugified title fragment
|
||||||
slug = tid + "_" + slugify(title)[:10].replace('-','_')
|
slug = tid + "_" + slugify(title)[:10].replace('-','_')
|
||||||
nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave_slug':str(cave), 'slug': slug, 'entry_type':entry_type}
|
nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave_slug':str(cave), 'slug': slug, 'entry_type':entry_type}
|
||||||
|
|
||||||
lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs)
|
lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user