Skip to content

Commit

Permalink
use apps.is_installed
Browse files Browse the repository at this point in the history
  • Loading branch information
jpaniagualaconich committed Feb 3, 2024
1 parent c70ebfc commit 5cecf66
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions two_factor/plugins/phonenumber/apps.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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())
Expand Down

0 comments on commit 5cecf66

Please sign in to comment.