conditional import

This commit is contained in:
Philippe Luickx 2015-08-07 11:25:40 +03:00
parent a9d2a24011
commit 8ea935ef40

View File

@ -1,7 +1,12 @@
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
from allauth.socialaccount.helpers import complete_social_login # Import is needed only if we are using social login, in which
# case the allauth.socialaccount will be declared
try:
from allauth.socialaccount.helpers import complete_social_login
except ImportError:
pass
class SocialLoginSerializer(serializers.Serializer): class SocialLoginSerializer(serializers.Serializer):