mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-02-06 21:20:32 +03:00
Fix the optional deps for allauth.socialaccount
This commit is contained in:
parent
74fa6cdf38
commit
680f24e43d
|
@ -1,15 +1,17 @@
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from requests.exceptions import HTTPError
|
from requests.exceptions import HTTPError
|
||||||
# Import is needed only if we are using social login, in which
|
# Import is needed only if we are using social login, in which
|
||||||
# case the allauth.socialaccount will be declared
|
# case the allauth.socialaccount will be declared
|
||||||
try:
|
try:
|
||||||
apps.get_app_config('allauth.socialaccount')
|
|
||||||
from allauth.socialaccount.helpers import complete_social_login
|
from allauth.socialaccount.helpers import complete_social_login
|
||||||
except LookupError:
|
|
||||||
pass
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
raise ImportError('allauth.socialaccount needs to be installed.')
|
||||||
|
|
||||||
|
if 'allauth.socialaccount' not in settings.INSTALLED_APPS:
|
||||||
|
raise ImportError('allauth.socialaccount needs to be added to INSTALLED_APPS.')
|
||||||
|
|
||||||
|
|
||||||
class SocialLoginSerializer(serializers.Serializer):
|
class SocialLoginSerializer(serializers.Serializer):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user