1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
import os
import re
from pathlib import Path
import django.forms as forms
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render
from django.urls import reverse
from django.views.decorators.csrf import ensure_csrf_cookie
import troggle.settings as settings
from troggle.core.utils import (
COOKIE_MAX_AGE,
WriteAndCommitError,
current_expo,
get_cookie,
git_string,
write_and_commit,
)
from troggle.core.views.editor_helpers import HTMLarea
from .auth import login_required_if_public
"""The new user signup form and expo user management system in 2025.
"""
@ensure_csrf_cookie
def signup(request):
if request.method == "POST": # If the form has been submitted...
pageform = ExpoSignupForm(request.POST) # A form bound to the POST data
if pageform.is_valid():
print(f"form OK")
who = pageform.cleaned_data["name"]
who = git_string(name)
print(f"{who=}")
return render(
request,
"signup.html",
{"form": pageform,
"year": "2025", "dates": "30th June - 3rd August",
"name": f"{who}",
}
)
else:
pageform = ExpoSignupForm(initial={"allergies":"None",
"medication":"None",
"medic_info":"None",
"veggie": "mostly",
"student": "no",
"top_tent_cap": 2,
"base_tent_cap": 3,
})
return render(
request,
"signup.html",
{"form": pageform,
"year": "2025", "dates": "30th June - 3rd August",
},
)
class ExpoSignupForm(forms.Form):
name = forms.CharField(label='Full name', max_length=100, widget=forms.TextInput(attrs={'tabindex': 1, 'placeholder': 'Anathema Device'}))
address = forms.CharField(widget=forms.Textarea(attrs={'rows': 7, 'cols': 20, 'tabindex': 2, 'placeholder': 'The Airfield,\nTadfield'}))
phone = forms.CharField(max_length=15, widget=forms.TextInput(attrs={'tabindex': 3, 'placeholder': '+44.1234567890'}))
email = forms.EmailField(widget=forms.TextInput(attrs={'tabindex': 4, 'placeholder': 'a.device@potatohut.expo'}))
kinname = forms.CharField(label='Next of Kin name', max_length=100, widget=forms.TextInput(attrs={'tabindex': 5, 'placeholder': 'Newton Pulsifer'}))
kinaddress = forms.CharField(widget=forms.Textarea(attrs={'rows': 7, 'cols': 20, 'tabindex': 6, 'placeholder': 'c/o The Old Ship Inn,\nLower Tadfield'}))
kinphone = forms.CharField(max_length=15, widget=forms.TextInput(attrs={'tabindex': 7, 'placeholder': '+44.0987654321'}))
kinemail = forms.EmailField(widget=forms.TextInput(attrs={'tabindex': 8, 'placeholder': 'n.pulsifer@basecamp.expo'}))
relation = forms.CharField(label='Relation to you', max_length=100, widget=forms.TextInput(attrs={'tabindex': 9, 'placeholder': 'Beau'}))
VEGGIE_CHOICES = [
('vegan', 'Vegan'),
('yes', 'Vegetarian'),
('mostly', 'Mostly Vegetarian'),
('no', 'No'),
]
STUDENT_CHOICES = [
('yes', 'Yes, I am an impecunious starvelling'),
('no', 'No, I have pots of dosh'),
]
veggie = forms.ChoiceField(choices=VEGGIE_CHOICES, widget=forms.RadioSelect(attrs={'tabindex': 10}))
student = forms.ChoiceField(choices=STUDENT_CHOICES, widget=forms.RadioSelect(attrs={'tabindex': 11}))
transport_ok = forms.ChoiceField(choices=[('yes', 'Yes, I have arranged transport'), ('no', 'No, I need transport')],
widget=forms.RadioSelect(attrs={'tabindex': 12}), initial='no')
transport_info = forms.CharField(widget=forms.Textarea(attrs={'rows': 6, 'cols': 80, 'tabindex': 13, "placeholder":"I am a numpty and have no clue how I will get there (or back)."}),
required=False)
bivvy = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'tabindex': 14, }))
tent = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'tabindex': 15}))
top_tent_cap = forms.IntegerField(required=False, widget=forms.TextInput(attrs={'size': 1, 'tabindex': 16, "placeholder":2}))
btent = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'tabindex': 17}))
base_tent_cap = forms.IntegerField(required=False, widget=forms.TextInput(attrs={'size': 1, 'tabindex': 18, "size":1, "placeholder":3}))
allergies = forms.CharField(widget=forms.Textarea(attrs={'rows': 2, 'cols': 80, 'tabindex': 19}), required=False)
medication = forms.CharField(widget=forms.Textarea(attrs={'rows': 2, 'cols': 80, 'tabindex': 20}), required=False)
medic_info = forms.CharField(widget=forms.Textarea(attrs={'rows': 5, 'cols': 80, 'tabindex': 21}), required=False)
extra_info = forms.CharField(widget=forms.Textarea(attrs={'rows': 5, 'cols': 80, 'tabindex': 22,
'placeholder': 'Estuary english (fluent),\nCan use the potato hut bread machine (level 3 certificate)'}), required=False)
aims = forms.CharField(widget=forms.Textarea(attrs={'rows': 5, 'cols': 80, 'tabindex': 23, 'placeholder': 'Strolling over the plateau, sunning myself and taking in the views.'}), required=False)
|