1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 01:26:54 +00:00

Update the email address in the mailing lists if it changed

This commit is contained in:
Yohann D'ANELLO 2020-10-11 16:57:11 +02:00
parent 1b1651c294
commit a5e7325a5b

View File

@ -1,5 +1,6 @@
from django.contrib.auth.models import User
from corres2math.lists import get_sympa_client
from .models import AdminRegistration, Registration
@ -17,6 +18,11 @@ def send_email_link(instance, **_):
registration.user = instance
registration.send_email_validation_link()
if registration.team:
get_sympa_client().unsubscribe(old_instance.email, f"equipe-{registration.team.trigram}", False)
get_sympa_client().subscribe(instance.email, f"equipe-{registration.team.trigram}", False,
f"{instance.first_name} {instance.last_name}")
def create_admin_registration(instance, **_):
if instance.is_superuser: