Users can't join a team after validation

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-03-24 10:29:45 +01:00
parent 1dd9a5cf94
commit 7f7ac5d5e6
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 26 additions and 22 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: TFJM\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-23 23:02+0100\n"
"POT-Creation-Date: 2024-03-24 10:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Emmy D'Anello <emmy.danello@animath.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -490,55 +490,59 @@ msgstr "Ce trigramme est déjà utilisé."
msgid "No team was found with this access code."
msgstr "Aucune équipe n'a été trouvée avec ce code d'accès."
#: participation/forms.py:85 participation/forms.py:355
#: participation/forms.py:60 participation/views.py:443
msgid "The team is already validated or the validation is pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: participation/forms.py:89 participation/forms.py:359
#: registration/forms.py:122 registration/forms.py:144
#: registration/forms.py:166 registration/forms.py:188
#: registration/forms.py:237 registration/forms.py:270
msgid "The uploaded file size must be under 2 Mo."
msgstr "Le fichier envoyé doit peser moins de 2 Mo."
#: participation/forms.py:87 registration/forms.py:124
#: participation/forms.py:91 registration/forms.py:124
#: registration/forms.py:146 registration/forms.py:168
#: registration/forms.py:190 registration/forms.py:239
#: registration/forms.py:272
msgid "The uploaded file must be a PDF, PNG of JPEG file."
msgstr "Le fichier envoyé doit être au format PDF, PNG ou JPEG."
#: participation/forms.py:105
#: participation/forms.py:109
msgid "I engage myself to participate to the whole TFJM²."
msgstr "Je m'engage à participer à l'intégralité du TFJM²."
#: participation/forms.py:120
#: participation/forms.py:124
msgid "Message to address to the team:"
msgstr "Message à adresser à l'équipe :"
#: participation/forms.py:155
#: participation/forms.py:159
msgid "The uploaded file size must be under 5 Mo."
msgstr "Le fichier envoyé doit peser moins de 5 Mo."
#: participation/forms.py:157 participation/forms.py:357
#: participation/forms.py:161 participation/forms.py:361
msgid "The uploaded file must be a PDF file."
msgstr "Le fichier envoyé doit être au format PDF."
#: participation/forms.py:161
#: participation/forms.py:165
msgid "The PDF file must not have more than 30 pages."
msgstr "Le fichier PDF ne doit pas avoir plus de 30 pages."
#: participation/forms.py:228
#: participation/forms.py:232
#: participation/templates/participation/pool_detail.html:123
#: participation/templates/participation/tournament_detail.html:119
msgid "Add"
msgstr "Ajouter"
#: participation/forms.py:243
#: participation/forms.py:247
msgid "This user already exists, but is a participant."
msgstr "Cet⋅te utilisateur⋅rice existe déjà, mais en tant que participant⋅e."
#: participation/forms.py:254
#: participation/forms.py:258
msgid "CSV file:"
msgstr "Tableur au format CSV :"
#: participation/forms.py:278
#: participation/forms.py:282
msgid ""
"This file contains non-UTF-8 and non-ISO-8859-1 content. Please send your "
"sheet as a CSV file."
@ -546,30 +550,30 @@ msgstr ""
"Ce fichier contient des éléments non-UTF-8 et non-ISO-8859-1. Merci "
"d'envoyer votre tableur au format CSV."
#: participation/forms.py:293
#: participation/forms.py:297
msgid "Can't determine the pool size. Are you sure your file is correct?"
msgstr ""
"Impossible de déterminer la taille de la poule. Êtes-vous sûr⋅e que le "
"fichier est correct ?"
#: participation/forms.py:313
#: participation/forms.py:317
msgid "The following note is higher of the maximum expected value:"
msgstr "La note suivante est supérieure au maximum attendu :"
#: participation/forms.py:321
#: participation/forms.py:325
msgid "The following user was not found:"
msgstr "L'utilisateur⋅rice suivant n'a pas été trouvé :"
#: participation/forms.py:338
#: participation/forms.py:342
msgid "The defender, the opponent and the reporter must be different."
msgstr ""
"Les équipes défenseuse, opposante et rapportrice doivent être différent⋅es."
#: participation/forms.py:342
#: participation/forms.py:346
msgid "This defender did not work on this problem."
msgstr "Ce⋅tte défenseur⋅se ne travaille pas sur ce problème."
#: participation/forms.py:361
#: participation/forms.py:365
msgid "The PDF file must not have more than 2 pages."
msgstr "Le fichier PDF ne doit pas avoir plus de 2 pages."
@ -1728,10 +1732,6 @@ msgstr "Carnet de vaccination de {participant}.{ext}"
msgid "Photo authorizations of team {trigram}.zip"
msgstr "Autorisations de droit à l'image de l'équipe {trigram}.zip"
#: participation/views.py:443
msgid "The team is already validated or the validation is pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: participation/views.py:487
msgid "The team is not validated yet."
msgstr "L'équipe n'est pas encore validée."

View File

@ -54,6 +54,10 @@ class JoinTeamForm(forms.ModelForm):
access_code = self.cleaned_data["access_code"]
if not Team.objects.filter(access_code=access_code).exists():
raise ValidationError(_("No team was found with this access code."))
else:
team = Team.objects.get(access_code=access_code)
if team.participation.valid is not None:
raise ValidationError(_("The team is already validated or the validation is pending."))
return access_code
def clean(self):