1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

Ensure that teams have a participation

This commit is contained in:
Yohann D'ANELLO 2020-11-14 23:43:42 +01:00
parent 10932d1cc5
commit 48b34e4362
2 changed files with 4 additions and 2 deletions

View File

@ -65,7 +65,7 @@ class Team(models.Model):
"education", "education",
raise_error=False, raise_error=False,
) )
if self.participation.valid: if self.pk and self.participation.valid:
get_sympa_client().subscribe(self.email, "equipes", False, f"Equipe {self.name}") get_sympa_client().subscribe(self.email, "equipes", False, f"Equipe {self.name}")
get_sympa_client().subscribe(self.email, f"probleme-{self.participation.problem}", False, get_sympa_client().subscribe(self.email, f"probleme-{self.participation.problem}", False,
f"Equipe {self.name}") f"Equipe {self.name}")

View File

@ -2,7 +2,7 @@ from corres2math.lists import get_sympa_client
from participation.models import Participation, Team, Video from participation.models import Participation, Team, Video
def create_team_participation(instance, **_): def create_team_participation(instance, created, **_):
""" """
When a team got created, create an associated team and create Video objects. When a team got created, create an associated team and create Video objects.
""" """
@ -12,6 +12,8 @@ def create_team_participation(instance, **_):
if not participation.synthesis: if not participation.synthesis:
participation.synthesis = Video.objects.create() participation.synthesis = Video.objects.create()
participation.save() participation.save()
if not created:
participation.team.create_mailing_list()
def update_mailing_list(instance: Team, **_): def update_mailing_list(instance: Team, **_):