1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-02 03:18:32 +02:00

Make Sympa + payment support optional

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-06-07 16:35:08 +02:00
parent 2a775cedc1
commit c12972b718
10 changed files with 56 additions and 25 deletions

View File

@ -1,7 +1,9 @@
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from typing import Union
from django.conf import settings
from participation.models import Note, Participation, Passage, Pool, Team, Tournament
from registration.models import Payment
from tfjm.lists import get_sympa_client
@ -22,7 +24,7 @@ def update_mailing_list(instance: Team, raw, **_):
"""
When a team name or trigram got updated, update mailing lists
"""
if instance.pk and not raw:
if instance.pk and not raw and settings.ML_MANAGEMENT:
old_team = Team.objects.get(pk=instance.pk)
if old_team.trigram != instance.trigram:
# Delete old mailing list, create a new one
@ -41,7 +43,7 @@ def create_payments(instance: Participation, created, raw, **_):
"""
When a participation got created, create an associated payment.
"""
if instance.valid and not raw:
if instance.valid and not raw and settings.PAYMENT_MANAGEMENT:
for student in instance.team.students.all():
payment_qs = Payment.objects.filter(registrations=student, final=False)
if payment_qs.exists():