1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-08 06:50:19 +02:00

Add a lot of comments

This commit is contained in:
Yohann D'ANELLO
2020-10-30 19:46:46 +01:00
parent 971169fe2c
commit 8236a9fe14
16 changed files with 491 additions and 7 deletions

View File

@ -9,6 +9,10 @@ from .models import Participation, Phase, Team, Video
class TeamForm(forms.ModelForm):
"""
Form to create a team, with the name and the trigram,
and if the team accepts that Animath diffuse the videos.
"""
def clean_trigram(self):
trigram = self.cleaned_data["trigram"].upper()
if not re.match("[A-Z]{3}", trigram):
@ -21,6 +25,9 @@ class TeamForm(forms.ModelForm):
class JoinTeamForm(forms.ModelForm):
"""
Form to join a team by the access code.
"""
def clean_access_code(self):
access_code = self.cleaned_data["access_code"]
if not Team.objects.filter(access_code=access_code).exists():
@ -40,12 +47,18 @@ class JoinTeamForm(forms.ModelForm):
class ParticipationForm(forms.ModelForm):
"""
Form to update the problem of a team participation.
"""
class Meta:
model = Participation
fields = ('problem',)
class RequestValidationForm(forms.Form):
"""
Form to ask about validation.
"""
_form_type = forms.CharField(
initial="RequestValidationForm",
widget=forms.HiddenInput(),
@ -58,6 +71,9 @@ class RequestValidationForm(forms.Form):
class ValidateParticipationForm(forms.Form):
"""
Form to let administrators to accept or refuse a team.
"""
_form_type = forms.CharField(
initial="ValidateParticipationForm",
widget=forms.HiddenInput(),
@ -70,6 +86,9 @@ class ValidateParticipationForm(forms.Form):
class UploadVideoForm(forms.ModelForm):
"""
Form to upload a video, for a solution or a synthesis.
"""
class Meta:
model = Video
fields = ('link',)
@ -81,6 +100,9 @@ class UploadVideoForm(forms.ModelForm):
class PhaseForm(forms.ModelForm):
"""
Form to update the calendar of a phase.
"""
class Meta:
model = Phase
fields = ('start', 'end',)