1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 11:18:27 +02:00

Register new organizers

This commit is contained in:
Yohann D'ANELLO
2021-01-14 21:07:09 +01:00
parent 1a7a411e10
commit 3e7ff21746
7 changed files with 179 additions and 41 deletions

View File

@ -0,0 +1,43 @@
<!-- templates/signup.html -->
{% extends 'base.html' %}
{% load crispy_forms_filters %}
{% load i18n %}
{% block title %}{% trans "Add organizer" %}{% endblock %}
{% block extracss %}
{{ volunteer_registration_form.media }}
{% endblock %}
{% block content %}
<h2>{% trans "Add organizer" %}</h2>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<div id="registration_form"></div>
<button class="btn btn-success" type="submit">
{% trans "Add organizer" %}
</button>
</form>
<div id="volunteer_registration_form" class="d-none">
{{ volunteer_registration_form|crispy }}
</div>
<div id="admin_registration_form" class="d-none">
{{ admin_registration_form|crispy }}
</div>
{% endblock %}
{% block extrajavascript %}
<script>
$("#id_role").change(function() {
let selected_role = $("#id_role :selected");
if (selected_role.val() === "volunteer") {
$("#registration_form").html($("#volunteer_registration_form").html());
}
else {
$("#registration_form").html($("#admin_registration_form").html());
}
}).change();
</script>
{% endblock %}

View File

@ -1,7 +1,14 @@
{% extends "base.html" %}
{% load django_tables2 %}
{% load django_tables2 i18n %}
{% block content %}
{% if user.registration.is_admin %}
<button href="{% url "registration:add_organizer" %}" class="btn btn-block btn-secondary">
<i class="fas fa-user-plus"></i> {% trans "Add organizer" %}
</button>
<hr>
{% endif %}
{% render_table table %}
{% endblock %}