2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-01-20 20:04:51 +00:00

Signup now stitched in

This commit is contained in:
2025-01-24 01:31:06 +00:00
parent 072a04487d
commit 27a14d0a0f
2 changed files with 31 additions and 13 deletions

View File

@@ -3,7 +3,6 @@ import re
from pathlib import Path
import django.forms as forms
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render
from django.urls import reverse
@@ -25,11 +24,15 @@ from troggle.core.views.editor_helpers import HTMLarea
"""
@ensure_csrf_cookie
@login_required
def signup(request):
if request.user.username in ["expo", "expoadmin"]:
return redirect("/accounts/newregister/")
# /accounts/login/?next=/signup
current_user = request.user
personal_login = True
if current_user.is_anonymous:
personal_login = False
elif current_user.username in ["expo", "expoadmin"]:
personal_login = False
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():
@@ -39,8 +42,8 @@ def signup(request):
print(f"{who=}")
return render(
request,
"signup.html",
{"form": pageform,
"login/signup.html",
{"form": pageform, "personal_login": personal_login,
"year": "2025", "dates": "30th June - 3rd August",
}
)
@@ -55,7 +58,7 @@ def signup(request):
})
return render(
request,
"signup.html",
"login/signup.html",
{"form": pageform,
"year": "2025", "dates": "30th June - 3rd August",
},

View File

@@ -15,7 +15,7 @@ Loser Expo 2025 SIGN-UP Form
{% block head %}
{% endblock %}
{% load static %}
<!-- mostly autotranslated from PHP hence the garbage -->
<style type="text/css">
body { margin-left: 8%; margin-right: 8%; margin-bottom: 4% }
p.blocktext { margin-left: 48pt; margin-right: 48pt }
@@ -67,7 +67,13 @@ Loser Expo 2025 SIGN-UP Form
may be used without charge <em>in perpetuity</em> for expo-related purposes.</p>
<p>Submitting this form will subscribe you to the expo mailing list
if you are not already subscribed.
</p>
{% if personal_login %}
{% else %}
<button class="fancybutton" style="padding: 0.5em 25px; font-size: 100%;" onclick="window.location.href='/accounts/register/'" value = "Go to">
You need to register a personal login before you can signup to attend &rarr;
</button>
{% endif %}
<hr>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
@@ -146,8 +152,9 @@ Loser Expo 2025 SIGN-UP Form
<p>Leave the tick-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>The medical information entered here will appear in the Bier Book.
More personal medical information relevant to your safe treatment on expo in case of need should be privately communicated to
<a href="mailto:medic@austria.expo">the medical officer</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>
@@ -168,7 +175,15 @@ Loser Expo 2025 SIGN-UP Form
<h2>All done?</h2>
<!-- <p>Click the <b>Preview</b> button below to review your submission.</p> -->
<div style="text-align: center">
<input type="submit" value="Preview / Submit">
{% if personal_login %}
<button class="fancybutton" style="padding: 0.5em 25px; font-size: 100%;" type = "submit" >
Submit &rarr;
</button>
{% else %}
<button class="fancybutton" style="padding: 0.5em 25px; font-size: 100%;" onclick="window.location.href='/accounts/register/'" value = "Go to">
You need to register a personal login before you can signup to attend &rarr;
</button>
{% endif %}
</div>
</form>