2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 01:17:14 +00:00

more robust logbooks parsing

This commit is contained in:
Philip Sargent
2021-04-24 01:23:55 +01:00
parent b979bdb560
commit 8128870d57
2 changed files with 55 additions and 25 deletions

View File

@@ -176,13 +176,17 @@ def personexpedition(request, first_name='', last_name='', year=''):
def logbookentry(request, date, slug):
this_logbookentry = LogbookEntry.objects.filter(date=date, slug=slug)
if len(this_logbookentry)>1:
return render(request, 'object_list.html',{'object_list':this_logbookentry})
if this_logbookentry:
if len(this_logbookentry)>1:
return render(request, 'object_list.html',{'object_list':this_logbookentry})
else:
this_logbookentry=this_logbookentry[0]
return render(request, 'logbookentry.html', {'logbookentry': this_logbookentry})
else:
this_logbookentry=this_logbookentry[0]
return render(request, 'logbookentry.html', {'logbookentry': this_logbookentry})
msg =(f' Logbook entry slug:"{slug}" not found in database on date:"{date}" ')
print(msg)
return render(request, 'errors/generic.html',{'message':msg})
def logbookSearch(request, extra):
query_string = ''