diff --git a/apps/participation/models.py b/apps/participation/models.py
index 561ec9e..9c547c1 100644
--- a/apps/participation/models.py
+++ b/apps/participation/models.py
@@ -49,7 +49,7 @@ class Team(models.Model):
return self.participants.filter(studentregistration__isnull=False)
@property
- def coachs(self):
+ def coaches(self):
return self.participants.filter(coachregistration__isnull=False)
@property
diff --git a/apps/participation/signals.py b/apps/participation/signals.py
index d058258..d5b1394 100644
--- a/apps/participation/signals.py
+++ b/apps/participation/signals.py
@@ -31,7 +31,7 @@ def update_mailing_list(instance: Team, **_):
for student in instance.students.all():
get_sympa_client().subscribe(student.user.email, f"equipe-{instance.trigram.lower()}", False,
f"{student.user.first_name} {student.user.last_name}")
- for coach in instance.coachs.all():
+ for coach in instance.coaches.all():
get_sympa_client().subscribe(coach.user.email, f"equipe-{instance.trigram.lower()}", False,
f"{coach.user.first_name} {coach.user.last_name}")
diff --git a/apps/participation/templates/participation/team_detail.html b/apps/participation/templates/participation/team_detail.html
index eecaaf0..231ecbf 100644
--- a/apps/participation/templates/participation/team_detail.html
+++ b/apps/participation/templates/participation/team_detail.html
@@ -22,9 +22,9 @@
{% trans "Access code:" %}
{{ team.access_code }}
- {% trans "Coachs:" %}
+ {% trans "Coaches:" %}
- {% for coach in team.coachs.all %}
+ {% for coach in team.coaches.all %}
{{ coach }}{% if not forloop.last %},{% endif %}
{% empty %}
{% trans "any" %}
diff --git a/apps/participation/views.py b/apps/participation/views.py
index aca6a90..61d5ed3 100644
--- a/apps/participation/views.py
+++ b/apps/participation/views.py
@@ -173,11 +173,11 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
context["validation_form"] = ValidateParticipationForm(self.request.POST or None)
# A team is complete when there are at least 4 members plus a coache that have sent their authorizations,
# their health sheet, they confirmed their email address and under-18 people sent their parental authorization.
- context["can_validate"] = team.students.count() >= 4 and team.coachs.exists() and \
- all(r.email_confirmed for r in team.students.all()) and \
- all(r.photo_authorization for r in team.participants.all()) and \
- all(r.health_sheet for r in team.participants.all()) and \
- all(r.parental_authorization for r in team.students.all() if r.under_18)
+ context["can_validate"] = team.students.count() >= 4 and team.coaches.exists() and \
+ all(r.email_confirmed for r in team.students.all()) and \
+ all(r.photo_authorization for r in team.participants.all()) and \
+ all(r.health_sheet for r in team.participants.all()) and \
+ all(r.parental_authorization for r in team.students.all() if r.under_18)
return context
@@ -240,8 +240,16 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
mail_html = render_to_string("participation/mails/team_validated.html", mail_context)
send_mail("[TFJM²] Équipe validée", mail_plain, None, [self.object.email], html_message=mail_html)
- get_sympa_client().subscribe(self.object.email, "equipes", False, f"Equipe {self.object.name}")
- get_sympa_client().unsubscribe(self.object.email, "equipes-non-valides", False)
+ if self.object.participation.tournament.price == 0:
+ for registration in self.object.participants.all():
+ registration.payment.type = "free"
+ registration.payment.valid = True
+ registration.payment.save()
+ else:
+ for coach in self.object.coaches.all():
+ coach.payment.type = "free"
+ coach.payment.valid = True
+ coach.payment.save()
elif "invalidate" in self.request.POST:
self.object.participation.valid = None
self.object.participation.save()
@@ -372,7 +380,7 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView):
Matrix.kick(f"#equipe-{team.trigram.lower()}:tfjm.org",
f"@{request.user.registration.matrix_username}:tfjm.org",
"Équipe quittée")
- if team.students.count() + team.coachs.count() == 0:
+ if team.students.count() + team.coaches.count() == 0:
team.delete()
return redirect(reverse_lazy("index"))
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
index 306b303..1cc4326 100644
--- a/locale/fr/LC_MESSAGES/django.po
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -697,7 +697,7 @@ msgid "Access code:"
msgstr "Code d'accès :"
#: apps/participation/templates/participation/team_detail.html:25
-msgid "Coachs:"
+msgid "Coaches:"
msgstr "Encadrants :"
#: apps/participation/templates/participation/team_detail.html:34