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

initial signup form, copy of PHP

This commit is contained in:
2025-01-15 14:34:29 +00:00
parent 49c0c0fe3a
commit d31777dc8d
3 changed files with 239 additions and 0 deletions

View File

@@ -69,6 +69,33 @@ def spider(request, _):
return render(request, "pagenotfound.html", {"path": path}, status=404) return render(request, "pagenotfound.html", {"path": path}, status=404)
# return redirect("/?#") # so that suffixes applied by spider are no longer part of the url # 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): def map(request):
"""Serves unadorned the expoweb/map/slippy/map.html file""" """Serves unadorned the expoweb/map/slippy/map.html file"""
fn = Path(settings.EXPOWEB, "map", "slippy", "map.html") fn = Path(settings.EXPOWEB, "map", "slippy", "map.html")
@@ -550,3 +577,47 @@ class ExpoPageForm(forms.Form):
label = "Editor" label = "Editor"
) )
class ExpoSignupForm(forms.Form):
name = forms.CharField(label='Full name', max_length=100, widget=forms.TextInput(attrs={'tabindex': 1}))
address = forms.CharField(widget=forms.Textarea(attrs={'rows': 7, 'cols': 20, 'tabindex': 2}))
phone = forms.CharField(max_length=15, widget=forms.TextInput(attrs={'tabindex': 3}))
email = forms.EmailField(widget=forms.TextInput(attrs={'tabindex': 4}))
kinname = forms.CharField(label='Next of Kin name', max_length=100, widget=forms.TextInput(attrs={'tabindex': 5}))
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}))
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)

166
templates/signup.html Normal file
View File

@@ -0,0 +1,166 @@
<!-- signup.html - this text visible because this template has been included -->
{% extends "base.html" %}
{% block title %}
Loser Expo 2025 SIGN-UP Form
{% endblock %}
{% block extraheaders %}
{% include 'html_editor_scripts_css.html' %}
{% endblock %}
{% block content %}
{% block head %}
{% endblock %}
{% load static %}
<style type="text/css">
body { font-family: sans-serif; margin-left: 8%; margin-right: 8%; margin-top: 4%; margin-bottom: 4% }
p.blocktext { margin-left: 48pt; margin-right: 48pt }
div.blocktext { margin-left: 48pt; margin-right: 48pt }
ul.blocktext { margin-left: 48pt; margin-right: 48pt }
ol.blocktext { margin-left: 48pt; margin-right: 48pt }
h1 { font-size: 24pt; line-height: 100% }
h2 { color: #009900 }
h2.blocktext { color: #009900; margin-left: 48pt }
h3 { color: #2c105e }
h3.blocktext { color: #2c105e; margin-left: 48pt }
h4 { color: #0d664c }
a:link { text-decoration: none }
a:visited { text-decoration: none }
table.cal { width: 100% }
tr.odd { background-color: #cccccc; height: 56pt }
tr.even { background-color: #eeeeee; height: 56pt }
tr.oddvac { background-color: #888888; height: 56pt }
tr.evenvac { background-color: #888888; height: 56pt }
tr.head { background-color: #999999; height: 36pt }
td.cellhead { width: 12%; text-align: center }
td.cell { width: 12%; font-size: 12pt }
td.cellvac { background-color: #888888; width: 12%; font-size: 12pt }
td.meet { background-color: #c6c699; width: 12%; font-size: 12pt; text-align: center }
td.other { background-color: #998db5; width: 12%; font-size: 12pt }
td.date { background-color: #999999; width: 12%; font-size: 12pt; text-align: right }
td.white { background-color: #ffffff; width: 12% }
div.right { float: right; margin-right: 48pt }
img.padleft { margin-left: 24pt }
span.l { background: #7f96e8 }
</style>
<title>Loser Expo {{year}} Sign-up Form</title>
<h1>Expo {{year}} Signup Form {{dates}}</h1>
<p>This is the official signup form for Expo {{year}}</p>
<p>This form is not secure and by submitting this form you consent to its contents being used for Expo purposes and being included in the Bier Book on Expo.</p>
<p>You also give permission for any information you collect on expo (survey data, photos, trip writeups, etc.) to be used in perpetuity for expo-related purposes.</p>
<p>BEFORE you fill out this form, you MUST sign up to the expo mailing list.
If you have not signed up to the mailing list, this form will FAIL and you will need to do it all again.
<hr>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<h2>Section A: Personal information</h2>
<h3>General</h3>
<table border="0">
<tr>
<td colspan="2"><b>Your details:</b></td>
<td colspan="2"><b>Next of kin:</b></td>
</tr>
<tr>
<td align="right"><i>Full</i> name:</td>
<td>{{ form.name }}</td>
<td align="right">Name:</td>
<td>{{ form.kinname }}</td>
</tr>
<tr>
<td align="right">Address:</td>
<td>{{ form.address }}</td>
<td align="right">Address:</td>
<td>{{ form.kinaddress }}</td>
</tr>
<tr>
<td align="right">Phone:</td>
<td>{{ form.phone }}</td>
<td align="right">Phone:</td>
<td>{{ form.kinphone }}</td>
</tr>
<tr>
<td align="right">Email:</td>
<td>{{ form.email }}</td>
<td align="right">Email:</td>
<td>{{ form.kinemail }}</td>
</tr>
<tr>
<td colspan="2"></td>
<td align="right">Relation to you:</td>
<td>{{ form.relation }}</td>
</tr>
</table>
<table width="100%">
<tr>
<td><b>Are you a vegetarian?</b></td>
<td><b>Are you a student/unwaged?</b></td>
</tr>
<tr>
<td>{{ form.veggie }}</td>
<td>{{ form.student }}</td>
</tr>
<h3>Transport</h3>
<p>Please look now at the <a target="_blank" href="http://expo.survex.com/years/2024/travel.html">transport arrangements page</a> (will open in a new window). Then select one of the following:</p>
<p>{{ form.transport_ok }}</p>
<p>If your arrangements are shown incorrectly, then please state the corrected version in the box below. This will automatically be emailed to the transport co-ordinator.</p>
<p>{{ form.transport_info }}</p>
<h3>Tents</h3>
<p>There will be two high camps in 2025:</p>
<ul>
<li>the stone bridge bivvy site;</li>
<li>Garlic Cave.</li>
</ul>
<p>There is space for three people in a Club tent at Base Camp. At the stone bridge, a bivvy bag is not essential but useful if you have one.</p>
<p>Will you be taking any of the following (please tick/complete as appropriate):</p>
<p>{{ form.bivvy }}</p>
<p>{{ form.tent }} A {{ form.top_tent_cap }} person tent for the Top Camp site.</p>
<p>{{ form.btent }} A {{ form.base_tent_cap }} person tent for Base Camp.</p>
<p>Leave the boxes unchecked if you require Club tent space at a particular site.</p>
<h3>Medical</h3>
<p>The medical information entered here will appear in the Bier Book. Extra medical information may be communicated to
<a href="mailto:mjg54&#64cam.ac.uk">Martin Green</a>; this will be placed in sealed envelopes inside the large first aid kits for use in case of emergency. Please ensure that you communicate such information in good time.</p>
<p>Please list any allergies which you have:</p>
<p>{{ form.allergies }}</p>
<p>Please list any medication which you may be taking in Austria:</p>
<p>{{ form.medication }}</p>
<p>Please list any other medical conditions you have that the expedition should be aware of:</p>
<p>{{ form.medic_info }}</p>
<h3>Other</h3>
<p>Any other information, including any skills e.g. first aid, languages, etc. that you have:</p>
<p>{{ form.extra_info }}</p>
<h2>Section B - Caving/surface work projects</h2>
<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>
<hr>
<h2>All done?</h2>
<p>Click the <b>Preview</b> button below to review your submission.</p>
<input type="submit" value="Preview form submission">
</form>
<hr>
<p>Please report any problems with this form to the <a href="mailto:wookey-expo@wookware.org">webmaster</a>.</p>
{% endblock %}

View File

@@ -34,6 +34,7 @@ from troggle.core.views.expo import (
mediapage, mediapage,
pubspage, pubspage,
spider, spider,
signup,
) )
from troggle.core.views.logbook_edit import logbookedit from troggle.core.views.logbook_edit import logbookedit
from troggle.core.views.logbooks import ( from troggle.core.views.logbooks import (
@@ -153,6 +154,7 @@ trogglepatterns = [
path('dwguploadnogit/<path:folder>', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing path('dwguploadnogit/<path:folder>', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing
path('logbookedit/', logbookedit, name='logbookedit'), path('logbookedit/', logbookedit, name='logbookedit'),
path('logbookedit/<slug:slug>', logbookedit, name='logbookedit'), path('logbookedit/<slug:slug>', logbookedit, name='logbookedit'),
path('sign_up', signup, name='signup'),
# Renaming an uploaded file # Renaming an uploaded file
path('expofilerename/<path:filepath>', expofilerename, name='expofilerename'), path('expofilerename/<path:filepath>', expofilerename, name='expofilerename'),