diff options
Diffstat (limited to 'core/views/logbooks.py')
-rw-r--r-- | core/views/logbooks.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/views/logbooks.py b/core/views/logbooks.py index ecf0f6b..82dbf61 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -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 = '' |