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

new signup form now split out

This commit is contained in:
2025-01-15 17:00:01 +00:00
parent d603bef64e
commit 21d69994e7
3 changed files with 103 additions and 78 deletions

View File

@@ -69,33 +69,6 @@ def spider(request, _):
return render(request, "pagenotfound.html", {"path": path}, status=404)
# return redirect("/?#") # so that suffixes applied by spider are no longer part of the url
@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(editor)
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", })
return render(
request,
"signup.html",
{"form": pageform,
"year": "2025", "dates": "30th June - 3rd August",
"name": "", "kinname": ""},
)
def map(request):
"""Serves unadorned the expoweb/map/slippy/map.html file"""
fn = Path(settings.EXPOWEB, "map", "slippy", "map.html")
@@ -576,48 +549,3 @@ class ExpoPageForm(forms.Form):
),
label = "Editor"
)
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}))
kinphone = forms.CharField(max_length=15, widget=forms.TextInput(attrs={'tabindex': 7}))
kinemail = forms.EmailField(widget=forms.TextInput(attrs={'tabindex': 8}))
relation = forms.CharField(label='Relation to you', max_length=100, widget=forms.TextInput(attrs={'tabindex': 9, 'placeholder': 'Beau'}))
VEGGIE_CHOICES = [
('yes', 'Yes'),
('mostly', 'Mostly'),
('no', 'No'),
]
STUDENT_CHOICES = [
('yes', 'Yes'),
('no', 'No'),
]
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'), ('no', 'No')],
widget=forms.RadioSelect(attrs={'tabindex': 12}), initial='yes')
transport_info = forms.CharField(widget=forms.Textarea(attrs={'rows': 6, 'cols': 80, 'tabindex': 13}),
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.NumberInput(attrs={'tabindex': 16}))
btent = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'tabindex': 17}))
base_tent_cap = forms.IntegerField(required=False, widget=forms.NumberInput(attrs={'tabindex': 18}))
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': 15, 'cols': 80, 'tabindex': 22}), required=False)
aims = forms.CharField(widget=forms.Textarea(attrs={'rows': 15, 'cols': 80, 'tabindex': 23}), required=False)