Skip to content

Commit 680f24e

Browse files
committed
Fix the optional deps for allauth.socialaccount
1 parent 74fa6cd commit 680f24e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

rest_auth/registration/serializers.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
from django.http import HttpRequest
2+
from django.conf import settings
3+
24
from rest_framework import serializers
35
from requests.exceptions import HTTPError
46
# Import is needed only if we are using social login, in which
57
# case the allauth.socialaccount will be declared
68
try:
7-
apps.get_app_config('allauth.socialaccount')
89
from allauth.socialaccount.helpers import complete_social_login
9-
except LookupError:
10-
pass
1110
except ImportError:
12-
pass
11+
raise ImportError('allauth.socialaccount needs to be installed.')
12+
13+
if 'allauth.socialaccount' not in settings.INSTALLED_APPS:
14+
raise ImportError('allauth.socialaccount needs to be added to INSTALLED_APPS.')
1315

1416

1517
class SocialLoginSerializer(serializers.Serializer):

0 commit comments

Comments
 (0)