1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 03:58:26 +02:00

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
2 changed files with 26 additions and 22 deletions

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):