Skip to content

Commit

Permalink
Merge 72670bf into 996a1c5
Browse files Browse the repository at this point in the history
  • Loading branch information
eelectronn authored Aug 29, 2020
2 parents 996a1c5 + 72670bf commit 5d6db1d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions rest_social_auth/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
from rest_framework.authtoken.models import Token


# Finding fields to be excluded from User Serializer
User = get_user_model()
user_fields = set([field.name for field in User._meta.get_fields()])
fields_to_exclude = {'is_staff', 'is_active', 'date_joined', 'password', 'last_login',
'user_permissions', 'groups', 'is_superuser'}
fields_to_exclude &= user_fields
fields_to_exclude = list(fields_to_exclude)


class OAuth2InputSerializer(serializers.Serializer):

provider = serializers.CharField(required=False)
Expand All @@ -24,10 +33,7 @@ class UserSerializer(serializers.ModelSerializer):

class Meta:
model = get_user_model()
exclude = (
'is_staff', 'is_active', 'date_joined', 'password', 'last_login', 'user_permissions',
'groups', 'is_superuser',
)
exclude = fields_to_exclude


class TokenSerializer(serializers.Serializer):
Expand Down

0 comments on commit 5d6db1d

Please sign in to comment.