summaryrefslogtreecommitdiffstats
path: root/core/views/signup.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-01-26 14:12:19 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2025-01-26 14:12:19 +0000
commit288ce80e074174654eabd6d92c541cc90dcdc99e (patch)
tree81eb8905242ff02409b1290ba8f8a56a93bfa569 /core/views/signup.py
parent3ad75d4439ae0d8bc1580c0494cdacd62b1d9a58 (diff)
downloadtroggle-288ce80e074174654eabd6d92c541cc90dcdc99e.tar.gz
troggle-288ce80e074174654eabd6d92c541cc90dcdc99e.tar.bz2
troggle-288ce80e074174654eabd6d92c541cc90dcdc99e.zip
Signup now saves list for bierbook & commits chnages
Diffstat (limited to 'core/views/signup.py')
-rw-r--r--core/views/signup.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/core/views/signup.py b/core/views/signup.py
index fdef549..5c06cf3 100644
--- a/core/views/signup.py
+++ b/core/views/signup.py
@@ -20,13 +20,19 @@ from troggle.core.models.troggle import DataIssue, Person
from troggle.core.views.editor_helpers import HTMLarea
from troggle.core.utils import (
add_commit,
+ write_and_commit,
+ current_expo
)
from troggle.parsers.users import get_encryptor, ENCRYPTED_DIR, how_many_previous_expos
+
"""The new user signup form and expo user management system in 2025.
"""
SIGNUPS_FILE = "signups.json"
SIGNEDUP = "SIGNEDUP"
+BIERBOOK = "documents/bierbook"
+BIERFILE = "names.txt"
+
SIGNUP_YEAR = "2025"
SIGNUP_DATES = "30th June - 3rd August"
@@ -145,7 +151,7 @@ def read_signups():
signups_clear ={}
for su, content in signups_dict.items():
clear_text = f.decrypt(content).decode()
- print(f"\n - {su} - {clear_text}")
+ # print(f"\n - {su} - {clear_text}")
signups_clear[su] = json.loads(clear_text)
return signups_clear
@@ -174,6 +180,9 @@ def save_signups(editor, person_slug, clean):
print(message)
raise
return render(request, "errors/generic.html", {"message": message})
+
+ print(f"- Exporting bierbook ")
+ write_bierbook(signups_clear, editor)
def write_signups(signups, encryptedfile, editor):
jsondict = { SIGNEDUP: signups }
@@ -191,6 +200,27 @@ def write_signups(signups, encryptedfile, editor):
print(f" ! Exception doing git add/commit <{e}>")
raise
return True
+
+def write_bierbook(signups_clear, editor):
+ bieryeardir = settings.EXPOWEB / BIERBOOK / current_expo()
+ bierfile = bieryeardir / BIERFILE
+ print(bierfile)
+
+ names = ""
+ for id in signups_clear:
+ names += f"{signups_clear[id]["name"]}\n"
+
+ for i in range(0,3):
+ names += "\\ldots\\ldots\\ldots\n"
+
+ print(names)
+ if not bieryeardir.is_dir():
+ bieryeardir.mkdir(parents=True, exist_ok=True)
+
+ write_and_commit( [(bierfile, names, "utf8")], f"(re)writing bierbook names", editor)
+
+
+
class ExpoSignupForm(forms.Form):