diff --git a/two_factor/plugins/phonenumber/apps.py b/two_factor/plugins/phonenumber/apps.py index c7b2aa9e3..3cdcac2e6 100644 --- a/two_factor/plugins/phonenumber/apps.py +++ b/two_factor/plugins/phonenumber/apps.py @@ -1,4 +1,4 @@ -from django.apps import AppConfig +from django.apps import AppConfig, apps from django.conf import settings from django.test.signals import setting_changed @@ -20,8 +20,7 @@ def update_registered_methods(sender, setting, value, **kwargs): # This allows for dynamic registration, typically when testing. from .method import PhoneCallMethod, SMSMethod - installed_apps = getattr(settings, 'INSTALLED_APPS') or [] - phone_number_app_installed = 'two_factor.plugins.phonenumber' in installed_apps + phone_number_app_installed = apps.is_installed('two_factor.plugins.phonenumber') if phone_number_app_installed and getattr(settings, 'TWO_FACTOR_CALL_GATEWAY', None): registry.register(PhoneCallMethod())