mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 09:06:40 +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
|
||||
docs/_build/
|
||||
|
||||
.DS_Store
|
||||
|
|
|
@ -7,7 +7,7 @@ from rest_auth.serializers import (
|
|||
PasswordResetSerializer as DefaultPasswordResetSerializer,
|
||||
PasswordResetConfirmSerializer as DefaultPasswordResetConfirmSerializer,
|
||||
PasswordChangeSerializer as DefaultPasswordChangeSerializer)
|
||||
from allauth.utils import import_callable
|
||||
from .utils import import_callable
|
||||
|
||||
|
||||
serializers = getattr(settings, 'REST_AUTH_SERIALIZERS', {})
|
||||
|
|
|
@ -14,8 +14,8 @@ class SocialLoginSerializer(serializers.Serializer):
|
|||
request = self.context.get('request')
|
||||
|
||||
if not view:
|
||||
raise serializers.ValidationError('View is not defined, pass it as\
|
||||
a context variable')
|
||||
raise serializers.ValidationError('View is not defined, pass it ' +
|
||||
'as a context variable')
|
||||
self.adapter_class = getattr(view, 'adapter_class', None)
|
||||
|
||||
if not self.adapter_class:
|
||||
|
|
|
@ -45,9 +45,7 @@ class UserDetailsSerializer(serializers.ModelSerializer):
|
|||
"""
|
||||
class Meta:
|
||||
model = get_user_model()
|
||||
exclude = ('password', 'groups', 'user_permissions', 'is_staff',
|
||||
'is_superuser')
|
||||
read_only_fields = ('id', 'last_login', 'is_active', 'date_joined')
|
||||
fields = ('username', 'email', 'first_name', 'last_name')
|
||||
|
||||
|
||||
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