move import later because django 3.2

This commit is contained in:
Thomas Steen Rasmussen 2021-05-21 21:03:19 +02:00
parent 22f02fa295
commit 2f3086e052
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,5 @@
import logging
from .email import add_new_membership_email
logger = logging.getLogger("bornhack.%s" % __name__)
@ -12,6 +11,8 @@ def teammember_saved(sender, instance, created, **kwargs):
# if this is a new unapproved teammember send a mail to team responsibles
if created and not instance.approved:
# call the mail sending function
# late import to please django 3.2 or "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."
from .email import add_new_membership_email
if not add_new_membership_email(instance):
logger.error("Error adding email to outgoing queue")