2020-12-27 10:49:54 +00:00
|
|
|
<!-- templates/signup.html -->
|
|
|
|
{% extends 'base.html' %}
|
|
|
|
{% load crispy_forms_filters %}
|
|
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% trans "Sign up" %}{% endblock %}
|
|
|
|
|
2020-12-28 22:59:21 +00:00
|
|
|
{% block extracss %}
|
|
|
|
{{ student_registration_form.media }}
|
|
|
|
{% endblock %}
|
|
|
|
|
2020-12-27 10:49:54 +00:00
|
|
|
{% block content %}
|
|
|
|
<h2>{% trans "Sign up" %}</h2>
|
|
|
|
|
|
|
|
<form method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
{{ form|crispy }}
|
2021-01-01 20:49:40 +00:00
|
|
|
<div id="registration_form"></div>
|
2020-12-27 10:49:54 +00:00
|
|
|
<button class="btn btn-success" type="submit">
|
|
|
|
{% trans "Sign up" %}
|
|
|
|
</button>
|
|
|
|
</form>
|
2021-01-01 20:49:40 +00:00
|
|
|
|
|
|
|
<div id="student_registration_form" class="d-none">
|
|
|
|
{{ student_registration_form|crispy }}
|
|
|
|
</div>
|
|
|
|
<div id="coach_registration_form" class="d-none">
|
|
|
|
{{ coach_registration_form|crispy }}
|
|
|
|
</div>
|
2020-12-27 10:49:54 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block extrajavascript %}
|
|
|
|
<script>
|
2023-02-20 15:55:30 +00:00
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
let role_elem = document.getElementById("id_role")
|
|
|
|
function updateView () {
|
|
|
|
let selected_role = role_elem.options[role_elem.selectedIndex].value
|
|
|
|
if (selected_role === "participant")
|
|
|
|
document.getElementById("registration_form").innerHTML = document.getElementById("student_registration_form").innerHTML
|
|
|
|
else
|
|
|
|
document.getElementById("registration_form").innerHTML = document.getElementById("coach_registration_form").innerHTML
|
|
|
|
}
|
|
|
|
role_elem.addEventListener('change', updateView)
|
|
|
|
updateView()
|
|
|
|
})
|
2020-12-27 10:49:54 +00:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|