2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-03-31 11:56:03 +01: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 from pathlib import Path
import django.forms as forms import django.forms as forms
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render from django.shortcuts import redirect, render
from django.urls import reverse from django.urls import reverse
@@ -25,11 +24,15 @@ from troggle.core.views.editor_helpers import HTMLarea
""" """
@ensure_csrf_cookie @ensure_csrf_cookie
@login_required
def signup(request): def signup(request):
if request.user.username in ["expo", "expoadmin"]: current_user = request.user
return redirect("/accounts/newregister/")
# /accounts/login/?next=/signup 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... if request.method == "POST": # If the form has been submitted...
pageform = ExpoSignupForm(request.POST) # A form bound to the POST data pageform = ExpoSignupForm(request.POST) # A form bound to the POST data
if pageform.is_valid(): if pageform.is_valid():
@@ -39,8 +42,8 @@ def signup(request):
print(f"{who=}") print(f"{who=}")
return render( return render(
request, request,
"signup.html", "login/signup.html",
{"form": pageform, {"form": pageform, "personal_login": personal_login,
"year": "2025", "dates": "30th June - 3rd August", "year": "2025", "dates": "30th June - 3rd August",
} }
) )
@@ -55,7 +58,7 @@ def signup(request):
}) })
return render( return render(
request, request,
"signup.html", "login/signup.html",
{"form": pageform, {"form": pageform,
"year": "2025", "dates": "30th June - 3rd August", "year": "2025", "dates": "30th June - 3rd August",
}, },

View File

@@ -15,7 +15,7 @@ Loser Expo 2025 SIGN-UP Form
{% block head %} {% block head %}
{% endblock %} {% endblock %}
{% load static %} {% load static %}
<!-- mostly autotranslated from PHP hence the garbage -->
<style type="text/css"> <style type="text/css">
body { margin-left: 8%; margin-right: 8%; margin-bottom: 4% } body { margin-left: 8%; margin-right: 8%; margin-bottom: 4% }
p.blocktext { margin-left: 48pt; margin-right: 48pt } 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> 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 <p>Submitting this form will subscribe you to the expo mailing list
if you are not already subscribed. 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> <hr>
<form action="{% url 'signup' %}" method="post"> <form action="{% url 'signup' %}" method="post">
{% csrf_token %} {% 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> <p>Leave the tick-boxes unchecked if you require Club tent space at a particular site.</p>
<h3>Medical</h3> <h3>Medical</h3>
<p>The medical information entered here will appear in the Bier Book. Extra medical information may be communicated to <p>The medical information entered here will appear in the Bier Book.
<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> 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>Please list any allergies which you have:</p>
<p>{{ form.allergies }}</p> <p>{{ form.allergies }}</p>
<p>Please list any medication which you may be taking in Austria:</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> <h2>All done?</h2>
<!-- <p>Click the <b>Preview</b> button below to review your submission.</p> --> <!-- <p>Click the <b>Preview</b> button below to review your submission.</p> -->
<div style="text-align: center"> <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> </div>
</form> </form>