1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 09:18:23 +02:00

Don't trigger signals on raw imports

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-03-22 14:42:14 +01:00
parent 7364d27b4b
commit 30efff0d9d
3 changed files with 20 additions and 18 deletions

View File

@ -43,12 +43,12 @@ def create_admin_registration(instance, **_):
VolunteerRegistration.objects.get_or_create(user=instance, admin=True)
def create_payment(instance: Registration, **_):
def create_payment(instance: Registration, raw, **_):
"""
When a user is saved, create the associated payment.
For a free tournament, the payment is valid.
"""
if instance.participates:
if instance.participates and not raw:
payment = Payment.objects.get_or_create(registration=instance)[0]
if instance.team and instance.team.participation.valid and instance.team.participation.tournament.price == 0:
payment.valid = True