summaryrefslogtreecommitdiffstats
path: root/core/views
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-02-05 20:02:03 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2024-02-05 20:02:03 +0000
commit1e00e565223f25658ccd1c0bbb88b1de14bfc19d (patch)
tree563281fca0e6bb441081b0a41f109cf91c44467a /core/views
parent1c19211c33d96085f711cc0586fee2dc7ae474ce (diff)
downloadtroggle-1e00e565223f25658ccd1c0bbb88b1de14bfc19d.tar.gz
troggle-1e00e565223f25658ccd1c0bbb88b1de14bfc19d.tar.bz2
troggle-1e00e565223f25658ccd1c0bbb88b1de14bfc19d.zip
check for non-existent expo
Diffstat (limited to 'core/views')
-rw-r--r--core/views/uploads.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py
index 136744b..5fa7d3b 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -252,7 +252,23 @@ def logbookedit(request, year=None, slug=None):
LogbookEntry.objects.filter(slug=slug).delete()
print(f"- Creating the LogBookEntry {slug}")
+ year = slug[0:4]
+ try:
+ expedition = Expedition.objects.get(year=year)
+ except Expedition.DoesNotExist:
+ message = f'''! - This expo "{year}" not created yet
+ It needs to be created before you can save a logbook entry.
+ See /handbook/computing/newyear.html
+
+ WHAT TO DO NOW:
+ 1. Press the Back button on your proswer to return to the screen where you typed up the entry,
+ 2. Copy the text of what you wrote into a new text file,
+ 3. Direct a nerd to fix this. It should take only a couple of minutes.'''
+ print(message)
+ return render(request, "errors/generic.html", {"message": message})
store_edited_entry_into_database(date, place, title, entry, others, author, tu, slug)
+
+
print(f"- Rewriting the entire {year} logbook to disc ")
filename= "logbook.html"
try: