From 680f24e43d6ba5cf4c713dcda3e8699fb979c066 Mon Sep 17 00:00:00 2001 From: mario Date: Sun, 4 Oct 2015 12:41:07 +0200 Subject: [PATCH] Fix the optional deps for `allauth.socialaccount` --- rest_auth/registration/serializers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 389c535..5f5efd6 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -1,15 +1,17 @@ from django.http import HttpRequest +from django.conf import settings + 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: - apps.get_app_config('allauth.socialaccount') from allauth.socialaccount.helpers import complete_social_login -except LookupError: - pass 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):