mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 12:27:09 +00:00
add prior expo experience (readonly)
This commit is contained in:
@@ -21,7 +21,7 @@ from troggle.core.views.editor_helpers import HTMLarea
|
||||
from troggle.core.utils import (
|
||||
add_commit,
|
||||
)
|
||||
from troggle.parsers.users import get_encryptor, ENCRYPTED_DIR
|
||||
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.
|
||||
"""
|
||||
@@ -69,6 +69,7 @@ def signup(request):
|
||||
else:
|
||||
editor = f"troggle <signup_anon@austria.expo>"
|
||||
|
||||
experience = how_many_previous_expos(signup_person)
|
||||
|
||||
if request.method == "POST": # If the form has been submitted...
|
||||
pageform = ExpoSignupForm(request.POST) # A form bound to the POST data
|
||||
@@ -103,7 +104,7 @@ def signup(request):
|
||||
if personal_login:
|
||||
initial_context["name"] = signup_person.fullname
|
||||
initial_context["email"] = signup_user.email
|
||||
|
||||
initial_context["experience"] = experience
|
||||
|
||||
|
||||
pageform = ExpoSignupForm(initial=initial_context)
|
||||
@@ -115,7 +116,7 @@ def signup(request):
|
||||
)
|
||||
|
||||
def read_signups():
|
||||
print(f" + READ signups")
|
||||
# print(f" + READ signups")
|
||||
f = get_encryptor()
|
||||
signups_dir = settings.EXPOWEB / ENCRYPTED_DIR / current_expo()
|
||||
if not signups_dir.is_dir():
|
||||
@@ -144,7 +145,7 @@ def read_signups():
|
||||
signups_clear ={}
|
||||
for su, content in signups_dict.items():
|
||||
clear_text = f.decrypt(content).decode()
|
||||
print(f"\n - C signups_dict {su} - {clear_text}")
|
||||
print(f"\n - {su} - {clear_text}")
|
||||
signups_clear[su] = json.loads(clear_text)
|
||||
|
||||
return signups_clear
|
||||
@@ -238,4 +239,6 @@ class ExpoSignupForm(forms.Form):
|
||||
'placeholder': 'Estuary english (fluent),\nCan use the potato hut bread machine (level 3 certificate)'}), required=False)
|
||||
|
||||
aims = forms.CharField(widget=forms.Textarea(attrs={'rows': 3, 'cols': 80, 'tabindex': 23, 'placeholder': 'Strolling over the plateau, sunning myself and taking in the views.'}), required=False)
|
||||
experience = forms.IntegerField(required=True, widget=forms.TextInput(attrs={'size': 1, 'tabindex': 24, 'readonly': 'readonly'}))
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
|
||||
from troggle.core.models.troggle import DataIssue, Person
|
||||
from troggle.core.models.troggle import DataIssue, Person, PersonExpedition
|
||||
from troggle.core.utils import current_expo
|
||||
|
||||
"""This imports the registered troggle users, who are nearly-all, but not quite, Persons.
|
||||
exceptions are "expo" and "expoadmin" which are created by the databaseReset.py import program.
|
||||
@@ -19,12 +20,16 @@ Passwords are only ever stored as hashes using the standard Django functions.
|
||||
"""
|
||||
|
||||
todo = """
|
||||
- Make all this work with New people who have never been on expo before
|
||||
- Not fully tested, needs experience
|
||||
"""
|
||||
|
||||
USERS_FILE = "users.json"
|
||||
ENCRYPTED_DIR = "encrypted"
|
||||
|
||||
def how_many_previous_expos(person):
|
||||
return PersonExpedition.objects.filter(person=person).exclude(expedition__year=current_expo()).count()
|
||||
|
||||
|
||||
def register_user(u, email, password=None, pwhash=None, fullname=""):
|
||||
"""Create User and we may not have a Person to tie it to if it is a future caver.
|
||||
Do not use the lastname field, put the whole free text identification into firstname
|
||||
|
||||
@@ -135,6 +135,7 @@ Loser Expo {{year}} SIGN-UP Form
|
||||
<h3>Caving/surface work projects</h3>
|
||||
<p>To assist organisation of gear, it would be helpful to know people's possible aims on Expo. Thus if you have a particular project in mind, please state it below:</p>
|
||||
<p>{{ form.aims }}</p>
|
||||
<p>Records show that you have been on {{ form.experience }} previous expos</p>
|
||||
|
||||
<h3>Public medical information</h3>
|
||||
<p>This is for anything medical you want everyone to be aware of. The medical information entered here will appear, on paper, in the Bier Book.
|
||||
|
||||
Reference in New Issue
Block a user