mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 17:16:34 +03:00
minor fixes
This commit is contained in:
parent
6ecb6a7847
commit
989f3fa7af
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -52,3 +52,4 @@ coverage.xml
|
||||||
# Sphinx documentation
|
# Sphinx documentation
|
||||||
docs/_build/
|
docs/_build/
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -7,7 +7,7 @@ from rest_auth.serializers import (
|
||||||
PasswordResetSerializer as DefaultPasswordResetSerializer,
|
PasswordResetSerializer as DefaultPasswordResetSerializer,
|
||||||
PasswordResetConfirmSerializer as DefaultPasswordResetConfirmSerializer,
|
PasswordResetConfirmSerializer as DefaultPasswordResetConfirmSerializer,
|
||||||
PasswordChangeSerializer as DefaultPasswordChangeSerializer)
|
PasswordChangeSerializer as DefaultPasswordChangeSerializer)
|
||||||
from allauth.utils import import_callable
|
from .utils import import_callable
|
||||||
|
|
||||||
|
|
||||||
serializers = getattr(settings, 'REST_AUTH_SERIALIZERS', {})
|
serializers = getattr(settings, 'REST_AUTH_SERIALIZERS', {})
|
||||||
|
|
|
@ -14,8 +14,8 @@ class SocialLoginSerializer(serializers.Serializer):
|
||||||
request = self.context.get('request')
|
request = self.context.get('request')
|
||||||
|
|
||||||
if not view:
|
if not view:
|
||||||
raise serializers.ValidationError('View is not defined, pass it as\
|
raise serializers.ValidationError('View is not defined, pass it ' +
|
||||||
a context variable')
|
'as a context variable')
|
||||||
self.adapter_class = getattr(view, 'adapter_class', None)
|
self.adapter_class = getattr(view, 'adapter_class', None)
|
||||||
|
|
||||||
if not self.adapter_class:
|
if not self.adapter_class:
|
||||||
|
|
|
@ -45,9 +45,7 @@ class UserDetailsSerializer(serializers.ModelSerializer):
|
||||||
"""
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = get_user_model()
|
model = get_user_model()
|
||||||
exclude = ('password', 'groups', 'user_permissions', 'is_staff',
|
fields = ('username', 'email', 'first_name', 'last_name')
|
||||||
'is_superuser')
|
|
||||||
read_only_fields = ('id', 'last_login', 'is_active', 'date_joined')
|
|
||||||
|
|
||||||
|
|
||||||
class PasswordResetSerializer(serializers.Serializer):
|
class PasswordResetSerializer(serializers.Serializer):
|
||||||
|
|
11
rest_auth/utils.py
Normal file
11
rest_auth/utils.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from django.utils.importlib import import_module
|
||||||
|
|
||||||
|
|
||||||
|
def import_callable(path_or_callable):
|
||||||
|
if hasattr(path_or_callable, '__call__'):
|
||||||
|
return path_or_callable
|
||||||
|
else:
|
||||||
|
assert isinstance(path_or_callable, (str, unicode))
|
||||||
|
package, attr = path_or_callable.rsplit('.', 1)
|
||||||
|
return getattr(import_module(package), attr)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user