1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-14 00:21:23 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Yohann D'ANELLO
e4fa6c0321
Use a checkbox widget to select tournament organizers 2021-01-19 01:19:18 +01:00
Yohann D'ANELLO
4821b090ae
Update on index page 2021-01-19 01:06:08 +01:00
Yohann D'ANELLO
0522db0f63
Install PyPDF3 in test environment 2021-01-19 00:38:21 +01:00
Yohann D'ANELLO
3e0e6ae7b4
Check that syntheses are valid files 2021-01-19 00:33:44 +01:00
Yohann D'ANELLO
d5e7295981
Detect when a solution has more than 30 pages 2021-01-19 00:32:34 +01:00
7 changed files with 115 additions and 65 deletions

View File

@ -3,6 +3,7 @@
import re
from PyPDF3 import PdfFileReader
from bootstrap_datepicker_plus import DatePickerInput, DateTimePickerInput
from django import forms
from django.core.exceptions import ValidationError
@ -108,6 +109,7 @@ class TournamentForm(forms.ModelForm):
format=formats.get_format_lazy(format_type="DATETIME_INPUT_FORMATS", use_l10n=True)[0])
self.fields["syntheses_second_phase_limit"].widget = DateTimePickerInput(
format=formats.get_format_lazy(format_type="DATETIME_INPUT_FORMATS", use_l10n=True)[0])
self.fields["organizers"].widget = forms.CheckboxSelectMultiple()
class Meta:
model = Tournament
@ -115,6 +117,19 @@ class TournamentForm(forms.ModelForm):
class SolutionForm(forms.ModelForm):
def clean_file(self):
if "file" in self.files:
file = self.files["file"]
if file.size > 5e6:
raise ValidationError(_("The uploaded file size must be under 5 Mo."))
if file.content_type != "application/pdf":
raise ValidationError(_("The uploaded file must be a PDF file."))
pdf_reader = PdfFileReader(file)
pages = len(pdf_reader.pages)
if pages > 30:
raise ValidationError(_("The PDF file must not have more than 30 pages."))
return self.cleaned_data["photo_authorization"]
def save(self, commit=True):
"""
Don't save a solution with this way. Use a view instead
@ -165,6 +180,15 @@ class PassageForm(forms.ModelForm):
class SynthesisForm(forms.ModelForm):
def clean_file(self):
if "file" in self.files:
file = self.files["file"]
if file.size > 2e6:
raise ValidationError(_("The uploaded file size must be under 2 Mo."))
if file.content_type != "application/pdf":
raise ValidationError(_("The uploaded file must be a PDF file."))
return self.cleaned_data["photo_authorization"]
def save(self, commit=True):
"""
Don't save a synthesis with this way. Use a view instead

View File

@ -47,7 +47,7 @@
</dl>
</div>
{% if user.registration.isadmin or user.registration in tournament.organizers.all %}
{% if user.registration.is_admin or user.registration in tournament.organizers.all %}
<div class="card-footer text-center">
<a href="{% url "participation:tournament_update" pk=tournament.pk %}"><button class="btn btn-secondary">{% trans "Edit tournament" %}</button></a>
</div>

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: TFJM\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-18 23:37+0100\n"
"POT-Creation-Date: 2021-01-19 00:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -104,27 +104,39 @@ msgstr "Changelog de type \"{action}\" pour le modèle {model} le {timestamp}"
msgid "valid"
msgstr "valide"
#: apps/participation/forms.py:22 apps/participation/models.py:37
#: apps/participation/forms.py:23 apps/participation/models.py:37
msgid "The trigram must be composed of three uppercase letters."
msgstr "Le trigramme doit être composé de trois lettres majuscules."
#: apps/participation/forms.py:37
#: apps/participation/forms.py:38
msgid "No team was found with this access code."
msgstr "Aucune équipe n'a été trouvée avec ce code d'accès."
#: apps/participation/forms.py:71
#: apps/participation/forms.py:72
msgid "I engage myself to participate to the whole TFJM²."
msgstr "Je m'engage à participer à l'intégralité du TFJM²."
#: apps/participation/forms.py:86
#: apps/participation/forms.py:87
msgid "Message to address to the team:"
msgstr "Message à adresser à l'équipe :"
#: apps/participation/forms.py:155
#: apps/participation/forms.py:123
msgid "The uploaded file size must be under 5 Mo."
msgstr "Le fichier envoyé doit peser moins de 5 Mo."
#: apps/participation/forms.py:125
msgid "The uploaded file must be a PDF file."
msgstr "Le fichier envoyé doit être au format PDF."
#: apps/participation/forms.py:129
msgid "The PDF file must not have more than 30 pages."
msgstr "Le fichier PDF ne doit pas avoir plus de 30 pages."
#: apps/participation/forms.py:169
msgid "The defender, the opponent and the reporter must be different."
msgstr "Le défenseur, l'opposant et le rapporteur doivent être différents."
#: apps/participation/forms.py:159
#: apps/participation/forms.py:173
msgid "This defender did not work on this problem."
msgstr "Ce défenseur ne travaille pas sur ce problème."
@ -784,7 +796,7 @@ msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/participation/templates/participation/team_detail.html:152
#: apps/participation/views.py:359
#: apps/participation/views.py:360
msgid "Leave team"
msgstr "Quitter l'équipe"
@ -872,49 +884,49 @@ msgstr "Tous les tournois"
msgid "Add tournament"
msgstr "Ajouter un tournoi"
#: apps/participation/views.py:39 tfjm/templates/base.html:74
#: apps/participation/views.py:40 tfjm/templates/base.html:74
#: tfjm/templates/base.html:233
msgid "Create team"
msgstr "Créer une équipe"
#: apps/participation/views.py:48 apps/participation/views.py:93
#: apps/participation/views.py:49 apps/participation/views.py:94
msgid "You don't participate, so you can't create a team."
msgstr "Vous ne participez pas, vous ne pouvez pas créer d'équipe."
#: apps/participation/views.py:50 apps/participation/views.py:95
#: apps/participation/views.py:51 apps/participation/views.py:96
msgid "You are already in a team."
msgstr "Vous êtes déjà dans une équipe."
#: apps/participation/views.py:84 tfjm/templates/base.html:79
#: apps/participation/views.py:85 tfjm/templates/base.html:79
#: tfjm/templates/base.html:228
msgid "Join team"
msgstr "Rejoindre une équipe"
#: apps/participation/views.py:146 apps/participation/views.py:365
#: apps/participation/views.py:398
#: apps/participation/views.py:147 apps/participation/views.py:366
#: apps/participation/views.py:399
msgid "You are not in a team."
msgstr "Vous n'êtes pas dans une équipe."
#: apps/participation/views.py:147 apps/participation/views.py:399
#: apps/participation/views.py:148 apps/participation/views.py:400
msgid "You don't participate, so you don't have any team."
msgstr "Vous ne participez pas, vous n'avez donc pas d'équipe."
#: apps/participation/views.py:171
#: apps/participation/views.py:172
#, python-brace-format
msgid "Detail of team {trigram}"
msgstr "Détails de l'équipe {trigram}"
#: apps/participation/views.py:204
#: apps/participation/views.py:205
msgid "You don't participate, so you can't request the validation of the team."
msgstr ""
"Vous ne participez pas, vous ne pouvez pas demander la validation de "
"l'équipe."
#: apps/participation/views.py:207
#: apps/participation/views.py:208
msgid "The validation of the team is already done or pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: apps/participation/views.py:210
#: apps/participation/views.py:211
msgid ""
"The team can't be validated: missing email address confirmations, "
"authorizations, people or the chosen problem is not set."
@ -923,56 +935,64 @@ msgstr ""
"d'adresse e-mail, soit une autorisation, soit des personnes soit le problème "
"n'a pas été choisi."
#: apps/participation/views.py:229
#: apps/participation/views.py:230
msgid "You are not an administrator."
msgstr "Vous n'êtes pas administrateur."
#: apps/participation/views.py:232
#: apps/participation/views.py:233
msgid "This team has no pending validation."
msgstr "L'équipe n'a pas de validation en attente."
#: apps/participation/views.py:262
#: apps/participation/views.py:263
msgid "You must specify if you validate the registration or not."
msgstr "Vous devez spécifier si vous validez l'inscription ou non."
#: apps/participation/views.py:293
#: apps/participation/views.py:294
#, python-brace-format
msgid "Update team {trigram}"
msgstr "Mise à jour de l'équipe {trigram}"
#: apps/participation/views.py:332
#: apps/participation/views.py:333
#, python-brace-format
msgid "Photo authorization of {participant}.{ext}"
msgstr "Autorisation de droit à l'image de {participant}.{ext}"
#: apps/participation/views.py:338
#: apps/participation/views.py:339
#, python-brace-format
msgid "Parental authorization of {participant}.{ext}"
msgstr "Autorisation parentale de {participant}.{ext}"
#: apps/participation/views.py:345
#: apps/participation/views.py:346
#, python-brace-format
msgid "Health sheet of {participant}.{ext}"
msgstr "Fiche sanitaire de {participant}.{ext}"
#: apps/participation/views.py:349
#: apps/participation/views.py:350
#, python-brace-format
msgid "Photo authorizations of team {trigram}.zip"
msgstr "Autorisations de droit à l'image de l'équipe {trigram}.zip"
#: apps/participation/views.py:367
#: apps/participation/views.py:368
msgid "The team is already validated or the validation is pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: apps/participation/views.py:413
#: apps/participation/views.py:414
msgid "The team is not validated yet."
msgstr "L'équipe n'est pas encore validée."
#: apps/participation/views.py:425
#: apps/participation/views.py:426
#, python-brace-format
msgid "Participation of team {trigram}"
msgstr "Participation de l'équipe {trigram}"
#: apps/participation/views.py:515
msgid "You can't upload a solution after the deadline."
msgstr "Vous ne pouvez pas envoyer de solution après la date limite."
#: apps/participation/views.py:695
msgid "You can't upload a synthesis after the deadline."
msgstr "Vous ne pouvez pas envoyer de note de synthèse après la date limite."
#: apps/registration/forms.py:21 apps/registration/forms.py:53
msgid "role"
msgstr "rôle"
@ -1185,7 +1205,7 @@ msgstr "nom de famille"
#: apps/registration/templates/registration/add_organizer.html:12
#: apps/registration/templates/registration/add_organizer.html:19
#: apps/registration/templates/registration/user_list.html:8
#: apps/registration/views.py:85
#: apps/registration/views.py:86
msgid "Add organizer"
msgstr "Ajouter un organisateur"
@ -1389,7 +1409,7 @@ msgstr ""
#: apps/registration/templates/registration/signup.html:5
#: apps/registration/templates/registration/signup.html:12
#: apps/registration/templates/registration/signup.html:19
#: apps/registration/views.py:41
#: apps/registration/views.py:42
msgid "Sign up"
msgstr "Inscription"
@ -1502,13 +1522,13 @@ msgid "Responsible email address:"
msgstr "Adresse e-mail du responsable légal :"
#: apps/registration/templates/registration/user_detail.html:102
msgid "Profesional activity:"
msgstr "Activité professionnelle :"
#: apps/registration/templates/registration/user_detail.html:105
msgid "Role:"
msgstr "Rôle :"
#: apps/registration/templates/registration/user_detail.html:105
msgid "Profesional activity:"
msgstr "Activité professionnelle :"
#: apps/registration/templates/registration/user_detail.html:109
msgid "Grant Animath to contact me in the future about other actions:"
msgstr "Autorise Animath à recontacter à propos d'autres actions :"
@ -1544,71 +1564,71 @@ msgid "Update user"
msgstr "Modifier l'utilisateur"
#: apps/registration/templates/registration/user_detail.html:161
#: apps/registration/views.py:312
#: apps/registration/views.py:313
msgid "Upload photo authorization"
msgstr "Téléverser l'autorisation de droit à l'image"
#: apps/registration/templates/registration/user_detail.html:166
#: apps/registration/views.py:338
#: apps/registration/views.py:339
msgid "Upload health sheet"
msgstr "Téléverser la fiche sanitaire"
#: apps/registration/templates/registration/user_detail.html:171
#: apps/registration/templates/registration/user_detail.html:176
#: apps/registration/views.py:364
#: apps/registration/views.py:365
msgid "Upload parental authorization"
msgstr "Téléverser l'autorisation parentale"
#: apps/registration/views.py:124
#: apps/registration/views.py:125
msgid "New TFJM² organizer account"
msgstr "Nouveau compte organisateur pour le TFJM²"
#: apps/registration/views.py:146
#: apps/registration/views.py:147
msgid "Email validation"
msgstr "Validation de l'adresse mail"
#: apps/registration/views.py:148
#: apps/registration/views.py:149
msgid "Validate email"
msgstr "Valider l'adresse mail"
#: apps/registration/views.py:187
#: apps/registration/views.py:188
msgid "Email validation unsuccessful"
msgstr "Échec de la validation de l'adresse mail"
#: apps/registration/views.py:198
#: apps/registration/views.py:199
msgid "Email validation email sent"
msgstr "Mail de confirmation de l'adresse mail envoyé"
#: apps/registration/views.py:206
#: apps/registration/views.py:207
msgid "Resend email validation link"
msgstr "Renvoyé le lien de validation de l'adresse mail"
#: apps/registration/views.py:246
#: apps/registration/views.py:247
#, python-brace-format
msgid "Detail of user {user}"
msgstr "Détails de l'utilisateur {user}"
#: apps/registration/views.py:276
#: apps/registration/views.py:277
#, python-brace-format
msgid "Update user {user}"
msgstr "Mise à jour de l'utilisateur {user}"
#: apps/registration/views.py:427
#: apps/registration/views.py:428
#, python-brace-format
msgid "Photo authorization of {student}.{ext}"
msgstr "Autorisation de droit à l'image de {student}.{ext}"
#: apps/registration/views.py:450
#: apps/registration/views.py:451
#, python-brace-format
msgid "Health sheet of {student}.{ext}"
msgstr "Fiche sanitaire de {student}.{ext}"
#: apps/registration/views.py:473
#: apps/registration/views.py:474
#, python-brace-format
msgid "Parental authorization of {student}.{ext}"
msgstr "Autorisation parentale de {student}.{ext}"
#: apps/registration/views.py:495
#: apps/registration/views.py:496
#, python-brace-format
msgid "Scholarship attestation of {user}.{ext}"
msgstr "Notification de bourse de {user}.{ext}"

View File

@ -17,6 +17,7 @@ gunicorn~=20.0
matrix-nio~=0.15
phonenumbers~=8.9.10
psycopg2-binary~=2.8
PyPDF3~=1.0.2
ipython~=7.19.0
python-magic==0.4.18
requests~=2.25.0

View File

@ -5,6 +5,7 @@
{% endblock %}
{% block content %}
<div class="text-justify">
<p>
La plateforme d'inscription du TFJM² a été développée entre 2019 et 2021
par Yohann D'ANELLO, bénévole pour l'association Animath. Elle est vouée à être utilisée par les participants
@ -37,4 +38,5 @@
&#99;&#111;&#110;&#116;&#97;&#99;&#116;&#64;&#116;&#102;&#106;&#109;&#46;&#111;&#114;&#103;
</a>.
</p>
</div>
{% endblock %}

View File

@ -6,15 +6,14 @@
<div class="jumbotron bg-white">
<div class="row">
<h1 class="display-3">
Bienvenue sur le site d'inscription au <a href="https://tfjm.org/" target="_blank">
TFJM²</a> !
Bienvenue sur le site d'inscription au <a href="https://tfjm.org/" target="_blank">𝕋𝔽𝕁𝕄²</a> !
</h1>
</div>
</div>
<div class="row jumbotron bg-white">
<div class="col-sm">
<h3>
Tu souhaites participer au TFJM² ?
Tu souhaites participer au 𝕋𝔽𝕁𝕄² ?
<br/>
Ton équipe est déjà formée ?
</h3>
@ -27,15 +26,18 @@
</div>
</div>
<div class="alert alert-danger">
Avertissement : certains rencontrent des difficultés à recevoir les mails automatiques. Merci de vérifier
régulièrement votre boîte spam, et à nous contacter en cas de problème.
</div>
<div class="alert alert-success">
<h4><strong><i class="fas fa-newspaper"></i> Grande nouveauté :</strong></h4>
Cette année, après avoir appris de l'édition complètement à distance de 2020, la communication se simplifie :
retrouvez-nous sur Element, disponible sur tous vos appareils, ou sur votre navigateur à l'adresse
<a class="alert-link" href="https://element.tfjm.org">element.tfjm.org</a>
(connectez-vous avec les identifiants de cette plateforme une fois inscrits)
</div>
<div class="jumbotron">
<h5 class="display-4">Comment ça marche ?</h5>
<p>
Pour participer au TFJM², il suffit de créer un compte sur la rubrique <strong><a href="{% url "registration:signup" %}">Inscription</a></strong>.
Pour participer au 𝕋𝔽𝕁𝕄², il suffit de créer un compte sur la rubrique <strong><a href="{% url "registration:signup" %}">Inscription</a></strong>.
Vous devrez ensuite confirmer votre adresse e-mail.
</p>
@ -43,7 +45,7 @@
Vous pouvez accéder à votre compte via la rubrique <strong><a href="{% url "login" %}">Connexion</a></strong>.
Une fois connecté, vous pourrez créer une équipe ou en rejoindre une déjà créée par l'un de vos camarades
via un code d'accès qui vous aura été transmis. Vous serez ensuite invité à soumettre une autorisation de droit à l'image,
indispensable au bon déroulement du TFJM². Une fois que votre équipe comporte au moins 3 participants (maximum 5)
indispensable au bon déroulement du 𝕋𝔽𝕁𝕄². Une fois que votre équipe comporte au moins 3 participants (maximum 5)
et un encadrant, vous pourrez demander à valider votre équipe pour être apte à travailler sur le problème de votre choix.
</p>
@ -51,10 +53,10 @@
<p class="text-justify">
En ayant créé un compte sur cette plateforme, vous créez également un compte sur la plateforme de chat dédiée
au TFJM², basée sur le protocole <a href="https://matrix.org/">Matrix</a> et le client
au 𝕋𝔽𝕁𝕄², basée sur le protocole <a href="https://matrix.org/">Matrix</a> et le client
<a href="https://element.io">Element</a>. Cette interface de chat vous permet de communiquer avec les membres
de votre équipe, mais surtout de pouvoir échanger durant la troisième phase du TFJM², et
également de poser vos questions en cas de besoin.
de votre équipe, mais surtout de pouvoir participer au tirage au sort et discuter avec les autres équipes et
les organisateurs.
</p>
<p class="text-justify">
@ -72,7 +74,7 @@
<div class="alert alert-warning">
<strong>Attention aux dates !</strong> Si vous ne finalisez pas votre inscription dans le délai indiqué, vous
ne pourrez malheureusement pas participer au TFJM².
ne pourrez malheureusement pas participer au 𝕋𝔽𝕁𝕄².
</div>
</div>

View File

@ -22,6 +22,7 @@ deps =
djangorestframework~=3.12
django-rest-polymorphic~=0.1
phonenumbers~=8.9.10
PyPDF3~=1.0.2
python-magic==0.4.18
whoosh~=2.7
commands =