1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-22 08:38:21 +02:00

Enable registration form

This commit is contained in:
Yohann D'ANELLO
2020-09-22 12:27:03 +02:00
parent 21a71f37f8
commit 0eef01ba9f
16 changed files with 207 additions and 18 deletions

View File

@ -10,8 +10,35 @@
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<div id="student_registration_form">
{{ student_registration_form|crispy }}
</div>
<div id="coach_registration_form" class="d-none">
{{ coach_registration_form|crispy }}
</div>
<button class="btn btn-success" type="submit">
{% trans "Sign up" %}
</button>
</form>
{% endblock %}
{% block extrajavascript %}
<script>
$(document).ready(function() {
$("#id_role").change(function() {
let selected_role = $("#id_role :selected");
if (selected_role.val() === "participant") {
$("#student_registration_form").removeClass("d-none");
$("#coach_registration_form").addClass("d-none");
}
else {
$("#student_registration_form").addClass("d-none");
$("#coach_registration_form").removeClass("d-none");
}
});
$("#student_registration_form :input").removeAttr("required");
$("#coach_registration_form :input").removeAttr("required");
});
</script>
{% endblock %}