plateforme-corres2math/apps/registration/templates/registration/signup.html

45 lines
1.4 KiB
HTML

<!-- templates/signup.html -->
{% extends 'base.html' %}
{% load crispy_forms_filters %}
{% load i18n %}
{% block title %}{% trans "Sign up" %}{% endblock %}
{% block content %}
<h2>{% trans "Sign up" %}</h2>
<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 %}