mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-11-09 03:09:57 +01:00
Add distinction between scientific coach and accompanying coach
This commit is contained in:
@@ -70,13 +70,21 @@ class Team(models.Model):
|
||||
@property
|
||||
def coaches(self):
|
||||
return self.participants.filter(coachregistration__isnull=False)
|
||||
|
||||
@property
|
||||
def scientific_coaches(self):
|
||||
return self.participants.filter(coachregistration__isnull=False, coachregistration__is_scientific_coach=True)
|
||||
|
||||
@property
|
||||
def accompanying_coaches(self):
|
||||
return self.participants.filter(coachregistration__isnull=False, coachregistration__is_accompanying_coach=True)
|
||||
|
||||
def can_validate(self):
|
||||
if any(not r.email_confirmed for r in self.participants.all()):
|
||||
return False
|
||||
if self.students.count() < 4:
|
||||
return False
|
||||
if not self.coaches.exists():
|
||||
if not self.scientific_coaches.exists():
|
||||
return False
|
||||
if not self.participation.tournament:
|
||||
return False
|
||||
@@ -211,6 +219,7 @@ class Team(models.Model):
|
||||
:return: The mailing list to contact the team members.
|
||||
"""
|
||||
return f"equipe-{slugify(self.trigram)}@{settings.SYMPA_HOST}"
|
||||
|
||||
|
||||
def create_mailing_list(self):
|
||||
"""
|
||||
|
||||
@@ -22,9 +22,18 @@
|
||||
<dt class="col-sm-6 text-sm-end">{% trans "Access code:" %}</dt>
|
||||
<dd class="col-sm-6">{{ team.access_code }}</dd>
|
||||
|
||||
<dt class="col-sm-6 text-sm-end">{% trans "Coaches:" %}</dt>
|
||||
<dt class="col-sm-6 text-sm-end">{% trans "Scientific coaches:" %}</dt>
|
||||
<dd class="col-sm-6">
|
||||
{% for coach in team.coaches.all %}
|
||||
{% for coach in team.scientific_coaches.all %}
|
||||
<a href="{% url "registration:user_detail" pk=coach.user.pk %}">{{ coach }}</a>{% if not forloop.last %},{% endif %}
|
||||
{% empty %}
|
||||
{% trans "any" %}
|
||||
{% endfor %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-6 text-sm-end">{% trans "Accompanying coaches:" %}</dt>
|
||||
<dd class="col-sm-6">
|
||||
{% for coach in team.accompanying_coaches.all %}
|
||||
<a href="{% url "registration:user_detail" pk=coach.user.pk %}">{{ coach }}</a>{% if not forloop.last %},{% endif %}
|
||||
{% empty %}
|
||||
{% trans "any" %}
|
||||
|
||||
@@ -285,6 +285,7 @@ class TestStudentParticipation(TestCase):
|
||||
self.coach.registration.vaccine_sheet = "authorization/vaccine/coach"
|
||||
self.coach.registration.photo_authorization = "authorization/photo/coach"
|
||||
self.coach.registration.email_confirmed = True
|
||||
self.coach.registration.is_scientific_coach = True
|
||||
self.coach.registration.save()
|
||||
|
||||
self.client.force_login(self.superuser)
|
||||
|
||||
Reference in New Issue
Block a user