1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-03 18:02:50 +02:00

Add & join teams

This commit is contained in:
Yohann D'ANELLO
2020-05-05 00:56:34 +02:00
parent b55aa6f4f3
commit 3889256fb1
8 changed files with 82 additions and 24 deletions

View File

@ -43,6 +43,16 @@ class JoinTeam(forms.Form):
max_length=6,
)
def clean(self):
cleaned_data = super().clean()
team = Team.objects.filter(access_code=cleaned_data["access_code"])
if not team.exists():
self.add_error('access_code', _("This access code is invalid."))
cleaned_data["team"] = team.get()
return cleaned_data
class SolutionForm(forms.ModelForm):
problem = forms.ChoiceField(