2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 04:17:11 +00:00

final final final: logbook edit form (humph)

This commit is contained in:
2025-02-17 23:01:56 +02:00
parent c23e93d7a7
commit 95190324fb
2 changed files with 18 additions and 6 deletions

View File

@@ -17,7 +17,8 @@ from troggle.core.utils import (
add_commit,
alphabet_suffix,
current_expo,
get_cookie,
get_editor,
is_identified_user,
git_string,
sanitize_name,
unique_slug,
@@ -162,7 +163,8 @@ def logbookedit(request, year=None, slug=None):
"form": form,
"year": year,
"yesterday": yesterday(),
"identified_login": identified_login,
"who_are_you": editor,
},
)
def clean_tu(tu):
@@ -186,8 +188,8 @@ def logbookedit(request, year=None, slug=None):
year = current_expo()
author = ""
editor = get_cookie(request)
identified_login = is_identified_user(request.user)
editor = get_editor(request)
if request.method == "POST":
prev_slug = "" # None value pending overwrite from submitted form
@@ -391,6 +393,7 @@ def logbookedit(request, year=None, slug=None):
text = lbe.text
rows = max(5,len(text)/50)
print("IDENT",identified_login, who_are_you)
return render(
request,
"logbookform.html",
@@ -407,12 +410,14 @@ def logbookedit(request, year=None, slug=None):
"entry": text,
"textrows": rows,
"slug": slug,
"identified_login": identified_login,
"who_are_you": editor,
},
)
class LogbookEditForm(forms.Form): # not a model-form, just a form-form
author = forms.CharField(strip=True, required=False)
identified_login = forms.BooleanField(required=False,widget=forms.CheckboxInput(attrs={"onclick":"return false"})) # makes it readonly
who_are_you = forms.CharField(
widget=forms.TextInput( # a manual form, not a Django generated form, so this widget is not used.
attrs={"size": 100, "placeholder": "You are editing this page, who are you ? e.g. 'Wookey' or 'Animal <mta@gasthof.expo>'",