1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-08-31 08:55:26 +02:00

INSTALLED_APPS checks

This commit is contained in:
Ehouarn
2025-08-30 01:55:03 +02:00
parent 99a90867cc
commit 2a638e7b32
3 changed files with 13 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
# Copyright (C) 2018-2025 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.conf import settings
def save_user_profile(instance, created, raw, **_kwargs):
"""
@@ -16,7 +18,7 @@ def save_user_profile(instance, created, raw, **_kwargs):
def update_wei_registration_fee_on_membership_creation(sender, instance, created, **kwargs):
if not hasattr(instance, "_no_signal") and created:
if not hasattr(instance, "_no_signal") and 'wei' in settings.INSTALLED_APPS and created:
from wei.models import WEIRegistration
if instance.club.id == 1 or instance.club.id == 2:
registrations = WEIRegistration.objects.filter(
@@ -29,8 +31,8 @@ def update_wei_registration_fee_on_membership_creation(sender, instance, created
def update_wei_registration_fee_on_club_change(sender, instance, **kwargs):
from wei.models import WEIRegistration
if not hasattr(instance, "_no_signal") and (instance.id == 1 or instance.id == 2):
if not hasattr(instance, "_no_signal") and 'wei' in settings.INSTALLED_APPS and (instance.id == 1 or instance.id == 2):
from wei.models import WEIRegistration
registrations = WEIRegistration.objects.filter(
wei__year=instance.membership_start.year,
)