mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 00:56:34 +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
|
||||
# Import is needed only if we are using social login, in which
|
||||
# case the allauth.socialaccount will be declared
|
||||
|
||||
if 'allauth.socialaccount' in settings.INSTALLED_APPS:
|
||||
try:
|
||||
from allauth.socialaccount.helpers import complete_social_login
|
||||
except ImportError:
|
||||
pass
|
||||
from allauth.socialaccount.helpers import complete_social_login
|
||||
|
||||
|
||||
class SocialLoginSerializer(serializers.Serializer):
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
from django.conf import settings
|
||||
from django.http import HttpRequest
|
||||
from rest_framework import serializers
|
||||
from requests.exceptions import HTTPError
|
||||
# Import is needed only if we are using social login, in which
|
||||
# case the allauth.socialaccount will be declared
|
||||
try:
|
||||
if 'allauth.socialaccount' in settings.INSTALLED_APPS:
|
||||
from allauth.socialaccount.helpers import complete_social_login
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from allauth.socialaccount.models import SocialToken
|
||||
from allauth.socialaccount.models import SocialToken
|
||||
|
||||
|
||||
class TwitterLoginSerializer(serializers.Serializer):
|
||||
|
|
Loading…
Reference in New Issue
Block a user