diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 7934bb3..09cd6b4 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -72,18 +72,18 @@ def expedition(request, expeditionname): ) return render(request, "errors/generic.html", {"message": message}) + ts = TROG["pagecache"]["expedition"] # not much use unless single user! if request.user.is_authenticated: logged_in = True if "reload" in request.GET: + if expeditionname in ts: + del ts[expeditionname] # clean out cache for page expo.logbookentry_set.all().delete() import_logbook(year=expo.year) else: logged_in = False - ts = TROG["pagecache"]["expedition"] # not much use unless single user! if settings.CACHEDPAGES: - len(TROG["pagecache"]["expedition"]) - # print(f'! - expo {expeditionname} CACHEDPAGES {nexpos} expo pages in cache.') if expeditionname in ts: # print('! - expo {expeditionanme} using cached page') return render(request, "expedition.html", {**ts[expeditionname], "logged_in": logged_in}) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 92efc54..ea927c1 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -543,6 +543,9 @@ def clean_logbook_for_expedition(expedition): """Only used when loading a single logbook. Deletes database LogBookEntries and DataIssues for this expedition year. """ + global tripsdate + tripsdate = {} + lbes = LogbookEntry.objects.filter(expedition=expedition).delete() dataissues = DataIssue.objects.filter(parser="logbooks") for di in dataissues: