summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-07-23 11:34:12 +0200
committerPhilip Sargent <philip.sargent@gmail.com>2024-07-23 11:34:12 +0200
commit07fc372b4175e683631ba1905526d927a066f97e (patch)
tree9a7f07ca428c383ebea5f4c73c24110bced686ad /core
parentfeaf38aa39eb867b359fa5ceab6fe7d3886fc782 (diff)
downloadtroggle-07fc372b4175e683631ba1905526d927a066f97e.tar.gz
troggle-07fc372b4175e683631ba1905526d927a066f97e.tar.bz2
troggle-07fc372b4175e683631ba1905526d927a066f97e.zip
belt and braces prevent bad lbe ids
Diffstat (limited to 'core')
-rw-r--r--core/views/uploads.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py
index c58bc65..0ad168c 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -306,7 +306,8 @@ def logbookedit(request, year=None, slug=None):
place = request.POST["place"].strip().replace(' - ',' = ') # no hyphens !
title = request.POST["title"].strip()
entry = request.POST["text"].strip()
- slug = request.POST["slug"].strip()
+ if "slug" in request.POST:
+ slug = request.POST["slug"].strip() # if we are re-editing the same entry again
entry = entry.replace('\r','') # remove HTML-standard CR inserted from form.
entry = entry.replace('\n\n','\n<p>\n') # replace 2 \n with <br><br>
# entry = entry.replace('\n\n','\n<br />\n<br />\n') # replace 2 \n with <br><br>
@@ -334,7 +335,7 @@ def logbookedit(request, year=None, slug=None):
authorflag = True
print(f"! Unrecognised author: {author}")
-
+ # slug is set either because we already posted or because it was specified inthe url
if not slug:
# Creating a new logbook entry with all the gubbins
slug = create_new_lbe_slug(date)