mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-24 08:11:52 +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)
|
||||
|
||||
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",
|
||||
|
@ -29,7 +29,8 @@
|
||||
<form method ='post' >
|
||||
{% csrf_token %}
|
||||
<br />
|
||||
|
||||
<input name="slug" id="slug" value="{{slug}}" type=hidden>
|
||||
|
||||
<span {% if dateflag %}style="color:red"{% endif %}>
|
||||
<label for="date">Date of the activity</label>
|
||||
<input {% if not user.username %} disabled{% endif %}
|
||||
|
@ -21,11 +21,11 @@
|
||||
<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 %}
|
||||
|
||||
|
||||
<input type="hidden" value="{{entry.slug}}" name="entry_slug">
|
||||
|
||||
<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>
|
||||
{% 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>
|
||||
{% regroup dateditems|dictsort:"date" by date as dates %}
|
||||
{% for date in dates %}
|
||||
@ -61,7 +61,9 @@
|
||||
</td>
|
||||
{% if logged_in %}
|
||||
<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>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user