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:
@ -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',)
|
||||
|
Reference in New Issue
Block a user