mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-11-17 07:27:42 +01:00
Add responsabilities of accompanying coaches + translate message about pending dates
This commit is contained in:
@@ -251,7 +251,18 @@ class CoachRegistrationForm(forms.ModelForm):
|
||||
"""
|
||||
A coach can tell its professional activity.
|
||||
"""
|
||||
ACCOMPANYING_CONFIRM_CHOICES = [
|
||||
("presence", _("I undertake to be present throughout the entire tournament weekend alongside the team (including overnight stays).")),
|
||||
("rules", _("I undertake to respond to the team's (non-mathematical) problems and not to hesitate to discuss them with the tournament organisers, who will be able to help.")),
|
||||
("cancelling", _("In case of absence, I undertake to notify the organisers as soon as possible, providing a replacement if possible.")),
|
||||
]
|
||||
|
||||
confirm_accompanying = forms.MultipleChoiceField(
|
||||
required=False,
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
choices=ACCOMPANYING_CONFIRM_CHOICES,
|
||||
label=_("Responsabilities of accompanying coaches")
|
||||
)
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if not settings.SUGGEST_ANIMATH:
|
||||
@@ -259,9 +270,21 @@ class CoachRegistrationForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = CoachRegistration
|
||||
fields = ('team', 'is_scientific_coach', 'is_accompanying_coach', 'gender', 'address', 'zip_code', 'city', 'country', 'phone_number',
|
||||
fields = ('team', 'is_scientific_coach', 'is_accompanying_coach', 'confirm_accompanying', 'gender', 'address', 'zip_code', 'city', 'country', 'phone_number',
|
||||
'last_degree', 'professional_activity', 'health_issues', 'housing_constraints',
|
||||
'give_contact_to_animath', 'email_confirmed')
|
||||
|
||||
def clean(self):
|
||||
cleaned = super().clean()
|
||||
if cleaned.get("is_accompanying_coach"):
|
||||
selected = set(cleaned.get("confirm_accompanying") or [])
|
||||
required = {key for key, _ in self.ACCOMPANYING_CONFIRM_CHOICES}
|
||||
if selected != required:
|
||||
self.add_error(
|
||||
"confirm_accompanying",
|
||||
_("Please tick all the required confirmations."),
|
||||
)
|
||||
return cleaned
|
||||
|
||||
|
||||
class VolunteerRegistrationForm(forms.ModelForm):
|
||||
|
||||
Reference in New Issue
Block a user