forked from expo/troggle
debug stuff for logreport
This commit is contained in:
+12
-3
@@ -51,7 +51,10 @@ def create_new_lbe_slug(date):
|
||||
suffix = alphabet_suffix(n+1)
|
||||
|
||||
tid = f"{date}{suffix}"
|
||||
print(tid)
|
||||
if len(tid) <=4 :
|
||||
print(f"BAD ERROR {tid=}")
|
||||
tid = f"{date}_{LogbookEntry.objects.count()}_{n}" # fudged number
|
||||
print(f"{tid=}")
|
||||
return tid
|
||||
|
||||
def store_edited_entry_into_database(date, place, title, text, others, author, tu, slug):
|
||||
@@ -275,7 +278,7 @@ def logbookedit(request, year=None, slug=None):
|
||||
return tu
|
||||
|
||||
if not year:
|
||||
if not slug:
|
||||
if not slug: # not in the URL, we have not read teh POST response yet.. wich might have a slug in it
|
||||
year = current_expo()
|
||||
else:
|
||||
year = slug[0:4]
|
||||
@@ -303,6 +306,7 @@ 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()
|
||||
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>
|
||||
@@ -439,8 +443,13 @@ def logbookedit(request, year=None, slug=None):
|
||||
+ msgdata
|
||||
)
|
||||
print(message)
|
||||
return render(request, "errors/generic.html", {"message": message})
|
||||
if not (lbe_commit.returncode ==1 and settings.DEVSERVER):
|
||||
# rc=1 is OK on the development server
|
||||
return render(request, "errors/generic.html", {"message": message})
|
||||
|
||||
# This does not change the URL in the browser, so despite a new slug being created,
|
||||
# the next time this code is run it thinks a new slug needs to be created. So we should
|
||||
# actually redirect to a new URL (an edit not a create) not simply return a render object.
|
||||
return render(
|
||||
request,
|
||||
"logbookform.html",
|
||||
|
||||
Reference in New Issue
Block a user