mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-02-16 18:00:35 +03:00
Import allauth.socialaccount only when declared in INSTALLED_APPS
Don't silently ignore ImportError
This commit is contained in:
parent
e3fc4e64e9
commit
86a487fe21
|
@ -15,12 +15,8 @@ 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
|
||||||
|
|
||||||
if 'allauth.socialaccount' in settings.INSTALLED_APPS:
|
if 'allauth.socialaccount' in settings.INSTALLED_APPS:
|
||||||
try:
|
|
||||||
from allauth.socialaccount.helpers import complete_social_login
|
from allauth.socialaccount.helpers import complete_social_login
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class SocialLoginSerializer(serializers.Serializer):
|
class SocialLoginSerializer(serializers.Serializer):
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
|
from django.conf import settings
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
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:
|
if 'allauth.socialaccount' in settings.INSTALLED_APPS:
|
||||||
from allauth.socialaccount.helpers import complete_social_login
|
from allauth.socialaccount.helpers import complete_social_login
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from allauth.socialaccount.models import SocialToken
|
from allauth.socialaccount.models import SocialToken
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user