1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-08 23:30:20 +02:00

Create more mailing lists

This commit is contained in:
Yohann D'ANELLO
2020-11-14 22:18:35 +01:00
parent 02ca1d1efe
commit 10932d1cc5
3 changed files with 55 additions and 0 deletions

View File

@ -65,11 +65,22 @@ class Team(models.Model):
"education",
raise_error=False,
)
if self.participation.valid:
get_sympa_client().subscribe(self.email, "equipes", False, f"Equipe {self.name}")
get_sympa_client().subscribe(self.email, f"probleme-{self.participation.problem}", False,
f"Equipe {self.name}")
else:
get_sympa_client().subscribe(self.email, "equipes-non-valides", False)
def delete_mailing_list(self):
"""
Drop the Sympa mailing list, if the team is empty or if the trigram changed.
"""
if self.participation.valid:
get_sympa_client().unsubscribe(self.email, "equipes", False)
get_sympa_client().unsubscribe(self.email, f"probleme-{self.participation.problem}", False)
else:
get_sympa_client().unsubscribe(self.email, "equipes-non-valides", False)
get_sympa_client().delete_list(f"equipe-{self.trigram}")
def save(self, *args, **kwargs):