mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
better placeholder/value setting
This commit is contained in:
parent
b1a5251768
commit
9e9c24ad44
@ -60,7 +60,6 @@ def logbookedit(request, year=None):
|
||||
"""Type in a logbook entry.
|
||||
No editing yet, name is implying a future enhancement
|
||||
"""
|
||||
author = "Zonker"
|
||||
if not year:
|
||||
year = 2023
|
||||
|
||||
@ -72,14 +71,15 @@ def logbookedit(request, year=None):
|
||||
return render(request, "errors/generic.html", {"message": message})
|
||||
else:
|
||||
# validation all to be done yet..
|
||||
author = request.POST["author"]
|
||||
date = request.POST["date"]
|
||||
others = request.POST["others"]
|
||||
place = request.POST["place"]
|
||||
date = request.POST["date"] # check valid and this year
|
||||
author = request.POST["author"] # check against personexpedition
|
||||
others = request.POST["others"] # check each against personexpedition
|
||||
place = request.POST["place"] # no hyphens !
|
||||
title = request.POST["title"]
|
||||
entry = request.POST["text"]
|
||||
tu = request.POST["tu"]
|
||||
seq = 99
|
||||
entry = request.POST["text"] # replace 2 \n or <p> with <br><br>
|
||||
tu = request.POST["tu"] # check numeric
|
||||
seq = 99 # should match the number of entries on this date +1 in the db already
|
||||
|
||||
# OK this could be done by rendering a template, but for such a small bit of HTML, it is easier to have
|
||||
# it all in one place: here
|
||||
output = f'''
|
||||
@ -95,7 +95,11 @@ def logbookedit(request, year=None):
|
||||
{
|
||||
"form": form,
|
||||
"year": year,
|
||||
"author": author,
|
||||
"date": date,
|
||||
"place": place,
|
||||
"title": title,
|
||||
"tu": tu,
|
||||
"entry": entry,
|
||||
"output": output,
|
||||
},
|
||||
)
|
||||
@ -109,7 +113,6 @@ def logbookedit(request, year=None):
|
||||
{
|
||||
"form": form,
|
||||
"year": year,
|
||||
"author": author,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -24,42 +24,45 @@
|
||||
{% csrf_token %}
|
||||
<br />
|
||||
|
||||
<label for="date">Date of the activity</label>
|
||||
<label for="date">Date of the activity</label>
|
||||
<input {% if not user.username %} disabled{% endif %}
|
||||
label = "Date" name = "date" size="12"
|
||||
title="Date of the activity, a single day, in ISO format: 2020-08-17"
|
||||
placeholder="{% if date %}{{date}}{% else %}2023-08-01{% endif %}" " required />
|
||||
{% if date %}value="{{date}}"{% else %}placeholder="2023-08-12"{% endif %}
|
||||
required />
|
||||
<br /><br />
|
||||
<label for="author">Your name (author) <a href="/aliases/{{year}}">[valid authors]</a></label>
|
||||
<input {% if not user.username %} disabled{% endif %}
|
||||
label = "author" name = "author" size="20"
|
||||
title="The person writing the logbook entry"
|
||||
placeholder="{{author}}" required />
|
||||
{% if author %}value="{{author}}"{% else %}placeholder="Animal"{% endif %}
|
||||
required />
|
||||
<br /><br />
|
||||
<label for="others">Other names (comma separated) <a href="/aliases/{{year}}">[valid aliases]</a></label>
|
||||
<input {% if not user.username %} disabled{% endif %}
|
||||
label = "others" name = "others" size="20"
|
||||
title="Everyone else involved"
|
||||
placeholder="Phil T, Chas, Planc" />
|
||||
{% if others %}value="{{others}}"{% else %}placeholder="Phil T, Chas, Planc" {% endif %}
|
||||
required />
|
||||
<br /><br />
|
||||
<label for="place">Place: cave name, or 'plateau', 'topcamp' etc.</label>
|
||||
<input {% if not user.username %} disabled{% endif %}
|
||||
label = "Place" name = "place" size="15"
|
||||
title="Place: cave name, or 'plateau', 'topcamp' "
|
||||
placeholder="basecamp" required />
|
||||
{% if place %}value="{{place}}"{% else %}placeholder="basecamp" {% endif %}
|
||||
required />
|
||||
<br /><br />
|
||||
<label for="title">Title</label>
|
||||
<input {% if not user.username %} disabled{% endif %}
|
||||
label = "Title" name = "title" size="30"
|
||||
title="What we did on our holidays"
|
||||
placeholder="What we did on our holidays" required />
|
||||
title="Title of your activity"
|
||||
{% if place %}value="{{title}}"{% else %}placeholder="What we did on our holidays" {% endif %}
|
||||
required />
|
||||
<br /><br />
|
||||
<label for="title"></label>
|
||||
<textarea {% if not user.username %} disabled{% endif %}
|
||||
rows="5" cols="60"
|
||||
label = "" name = "text"
|
||||
title="We had a lot of fun..."
|
||||
placeholder="We had a lot of fun..." required />We had a lot of fun...
|
||||
required />{% if entry %}{{entry}}{% else %}We had a lot of fun...{% endif %}
|
||||
</textarea>
|
||||
<br>
|
||||
[Type in text in <a href="/handbook/logbooks.html#format">Logbook HTML format</a>.]
|
||||
|
Loading…
Reference in New Issue
Block a user