mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 15:47:10 +00:00
bugfixes and more comments
This commit is contained in:
@@ -3,6 +3,7 @@ import re
|
||||
from django.db.models import Q
|
||||
from django.shortcuts import redirect, render
|
||||
from django.views.generic.list import ListView
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
import troggle.settings as settings
|
||||
from troggle.core.models.logbooks import QM, LogbookEntry, PersonLogEntry, writelogbook
|
||||
@@ -307,8 +308,17 @@ def logreport(request, year=1999):
|
||||
return render(request, "errors/generic.html", {"message": msg})
|
||||
|
||||
def logbookentry(request, date, slug):
|
||||
# start = time.time()
|
||||
trips = LogbookEntry.objects.filter(date=date) # all the trips not just this one
|
||||
"""Displays a single logbook entry
|
||||
however, if an author has not used the correct URL in an image or a reference, then a link from
|
||||
inside a logbook entry can arrive with this default address prefix. So we
|
||||
have to handle that error without crashing.
|
||||
"""
|
||||
try:
|
||||
trips = LogbookEntry.objects.filter(date=date) # all the trips not just this one
|
||||
except ValidationError:
|
||||
msg = f' Logbook entry invalid date:"{date}" probably because of relative (not absolute) addressing of "src=" or "haref=" in the text'
|
||||
print(msg)
|
||||
return render(request, "errors/generic.html", {"message": msg})
|
||||
this_logbookentry = trips.filter(date=date, slug=slug)
|
||||
year = slug[:4]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user