minor fixes

This commit is contained in:
Mateusz Sikora 2014-10-09 11:41:52 +02:00
parent 6ecb6a7847
commit 989f3fa7af
5 changed files with 16 additions and 6 deletions

1
.gitignore vendored
View File

@ -52,3 +52,4 @@ coverage.xml
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
.DS_Store

View File

@ -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', {})

View File

@ -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:

View File

@ -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
View 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)