2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-28 18:11:52 +00:00

check for non-existent expo

This commit is contained in:
Philip Sargent 2024-02-05 20:02:03 +00:00
parent 1c19211c33
commit 1e00e56522

View File

@ -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: