mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-24 04:28:48 +02:00
Add parental and photo authorizations + make health and vaccine sheet and motivation letter optional
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -81,12 +81,12 @@ class Team(models.Model):
|
||||
return False
|
||||
if any(not r.photo_authorization for r in self.participants.all()):
|
||||
return False
|
||||
if not self.motivation_letter:
|
||||
if settings.MOTIVATION_LETTER_REQUIRED and not self.motivation_letter:
|
||||
return False
|
||||
if not self.participation.tournament.remote:
|
||||
if any(r.under_18 and not r.health_sheet for r in self.students.all()):
|
||||
if settings.HEALTH_SHEET_REQUIRED and any(r.under_18 and not r.health_sheet for r in self.students.all()):
|
||||
return False
|
||||
if any(r.under_18 and not r.vaccine_sheet for r in self.students.all()):
|
||||
if settings.VACCINE_SHEET_REQUIRED and any(r.under_18 and not r.vaccine_sheet for r in self.students.all()):
|
||||
return False
|
||||
if any(r.under_18 and not r.parental_authorization for r in self.students.all()):
|
||||
return False
|
||||
@ -119,7 +119,7 @@ class Team(models.Model):
|
||||
'content': content,
|
||||
})
|
||||
|
||||
if not self.motivation_letter:
|
||||
if settings.MOTIVATION_LETTER_REQUIRED and not self.motivation_letter:
|
||||
text = _("The team {trigram} has not uploaded a motivation letter. "
|
||||
"You can upload your motivation letter using <a href='{url}'>this link</a>.")
|
||||
url = reverse_lazy("participation:upload_team_motivation_letter", args=(self.pk,))
|
||||
@ -458,7 +458,7 @@ class Tournament(models.Model):
|
||||
self.save()
|
||||
|
||||
def update_ranking_spreadsheet(self): # noqa: C901
|
||||
translation.activate('fr')
|
||||
translation.activate(settings.PREFERRED_LANGUAGE_CODE)
|
||||
|
||||
gc = gspread.service_account_from_dict(settings.GOOGLE_SERVICE_CLIENT)
|
||||
spreadsheet = gc.open_by_key(self.notes_sheet_id)
|
||||
@ -1101,7 +1101,7 @@ class Pool(models.Model):
|
||||
return super().validate_constraints()
|
||||
|
||||
def update_spreadsheet(self): # noqa: C901
|
||||
translation.activate('fr')
|
||||
translation.activate(settings.PREFERRED_LANGUAGE_CODE)
|
||||
|
||||
# Create tournament sheet if it does not exist
|
||||
self.tournament.create_spreadsheet()
|
||||
@ -1446,7 +1446,7 @@ class Pool(models.Model):
|
||||
worksheet.client.batch_update(spreadsheet.id, body)
|
||||
|
||||
def update_juries_lines_spreadsheet(self):
|
||||
translation.activate('fr')
|
||||
translation.activate(settings.PREFERRED_LANGUAGE_CODE)
|
||||
|
||||
gc = gspread.service_account_from_dict(settings.GOOGLE_SERVICE_CLIENT)
|
||||
spreadsheet = gc.open_by_key(self.tournament.notes_sheet_id)
|
||||
@ -1467,7 +1467,7 @@ class Pool(models.Model):
|
||||
max_row += 1
|
||||
|
||||
def parse_spreadsheet(self):
|
||||
translation.activate('fr')
|
||||
translation.activate(settings.PREFERRED_LANGUAGE_CODE)
|
||||
|
||||
gc = gspread.service_account_from_dict(settings.GOOGLE_SERVICE_CLIENT)
|
||||
self.tournament.create_spreadsheet()
|
||||
@ -1837,7 +1837,7 @@ class Note(models.Model):
|
||||
if not self.has_any_note():
|
||||
return
|
||||
|
||||
translation.activate('fr')
|
||||
translation.activate(settings.PREFERRED_LANGUAGE_CODE)
|
||||
|
||||
gc = gspread.service_account_from_dict(settings.GOOGLE_SERVICE_CLIENT)
|
||||
passage = Passage.objects.prefetch_related('pool__tournament', 'pool__participations').get(pk=self.passage.pk)
|
||||
|
Reference in New Issue
Block a user