From a2f4591f725026c224e11ae7f5265546bcf5bba9 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 23 Jul 2024 11:42:36 +0200 Subject: [PATCH] offline message --- core/views/statistics.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/views/statistics.py b/core/views/statistics.py index e344ed2..01e5d2f 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -267,7 +267,10 @@ def stats(request): def dataissues(request): - """Each issue has a parser, a message and a url linking to the offending object after loading""" + """Each issue has a parser, a message and a url linking to the offending object after loading + + This page happens to be the first one looked for, so if the server is offline, this is + where the error happens.""" def myFunc(di): return di.parser.lower() + di.message.lower() @@ -275,7 +278,12 @@ def dataissues(request): dilist = list(DataIssue.objects.all()) dilist.sort(key=myFunc) - return render(request, "dataissues.html", {"didict": dilist, "year": current_expo()}) + try: + return render(request, "dataissues.html", {"didict": dilist, "year": current_expo()}) + except: + message = f'! - Server not online - please wait 5 minutes for database rebuild' + print(message) + return render(request, "errors/generic.html", {"message": message}) def stations(request):