mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-28 10:02:10 +00:00
debug stuff for logreport
This commit is contained in:
parent
48f2407a06
commit
c01f0e1dff
@ -51,7 +51,10 @@ def create_new_lbe_slug(date):
|
|||||||
suffix = alphabet_suffix(n+1)
|
suffix = alphabet_suffix(n+1)
|
||||||
|
|
||||||
tid = f"{date}{suffix}"
|
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
|
return tid
|
||||||
|
|
||||||
def store_edited_entry_into_database(date, place, title, text, others, author, tu, slug):
|
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
|
return tu
|
||||||
|
|
||||||
if not year:
|
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()
|
year = current_expo()
|
||||||
else:
|
else:
|
||||||
year = slug[0:4]
|
year = slug[0:4]
|
||||||
@ -303,6 +306,7 @@ def logbookedit(request, year=None, slug=None):
|
|||||||
place = request.POST["place"].strip().replace(' - ',' = ') # no hyphens !
|
place = request.POST["place"].strip().replace(' - ',' = ') # no hyphens !
|
||||||
title = request.POST["title"].strip()
|
title = request.POST["title"].strip()
|
||||||
entry = request.POST["text"].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('\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<p>\n') # replace 2 \n with <br><br>
|
||||||
# entry = entry.replace('\n\n','\n<br />\n<br />\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
|
+ msgdata
|
||||||
)
|
)
|
||||||
print(message)
|
print(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})
|
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(
|
return render(
|
||||||
request,
|
request,
|
||||||
"logbookform.html",
|
"logbookform.html",
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
<form method ='post' >
|
<form method ='post' >
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<br />
|
<br />
|
||||||
|
<input name="slug" id="slug" value="{{slug}}" type=hidden>
|
||||||
|
|
||||||
<span {% if dateflag %}style="color:red"{% endif %}>
|
<span {% if dateflag %}style="color:red"{% endif %}>
|
||||||
<label for="date">Date of the activity</label>
|
<label for="date">Date of the activity</label>
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
<p>(Hover mouse over the date to see the slug for the entry.)
|
<p>(Hover mouse over the date to see the slug for the entry.)
|
||||||
{% if logged_in %}<font color="red">Logged in as expoadmin</font>{% endif %}
|
{% if logged_in %}<font color="red">Logged in as expoadmin</font>{% endif %}
|
||||||
|
|
||||||
|
<input type="hidden" value="{{entry.slug}}" name="entry_slug">
|
||||||
|
|
||||||
<table class="expeditionlogbooks">
|
<table class="expeditionlogbooks">
|
||||||
<tr><th>Date</th><th>Logged trips and diary entries</th><th>Cave</th><th>Text..</th><th>Words</th><th>Author</th><th>Who else</th>
|
<tr><th>Date</th><th>Logged trips and diary entries</th><th>Cave</th><th>Text..</th><th>Words</th><th>Author</th><th>Who else</th>
|
||||||
{% if logged_in %}<th><font color="red">Admin</font></th>{% endif %}
|
{% if logged_in %}<th width=110px>Slug</th><th><font color="red">Admin</font></th>{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% regroup dateditems|dictsort:"date" by date as dates %}
|
{% regroup dateditems|dictsort:"date" by date as dates %}
|
||||||
{% for date in dates %}
|
{% for date in dates %}
|
||||||
@ -61,7 +61,9 @@
|
|||||||
</td>
|
</td>
|
||||||
{% if logged_in %}
|
{% if logged_in %}
|
||||||
<form name="import" method="post" action="/logentrydelete/{{year}}">{% csrf_token %}
|
<form name="import" method="post" action="/logentrydelete/{{year}}">{% csrf_token %}
|
||||||
<td><input type="hidden" value="{{entry.slug}}" name="entry_slug">
|
<td>
|
||||||
|
{{entry.slug}}</td>
|
||||||
|
<td>
|
||||||
<input type="submit" value="delete"></td>
|
<input type="submit" value="delete"></td>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user