from django.contrib.auth import get_user_model
from rest_framework import serializers
from yak.rest_user.serializers import SignUpSerializer

User = get_user_model()


class SocialSignUpSerializer(SignUpSerializer):
    password = serializers.CharField(required=False, write_only=True)

    class Meta:
        model = User
        fields = ('fullname', 'username', 'email', 'password', 'client_id', 'client_secret')
        write_only_fields = ('access_token', 'access_token_secret')
        read_only_fields = ('fullname', 'username', 'email', 'client_id', 'client_secret')

from django.contrib.auth import get_user_model
from rest_framework import serializers
from yak.rest_user.serializers import LoginSerializer

User = get_user_model()


class SocialSignUpSerializer(LoginSerializer):
    fullname = serializers.CharField(read_only=True)
    username = serializers.CharField(read_only=True)
    email = serializers.EmailField(read_only=True)
    password = serializers.CharField(required=False, write_only=True)

    class Meta:
        model = User
        fields = ('fullname', 'username', 'email', 'password', 'client_id', 'client_secret')
        write_only_fields = ('access_token', 'access_token_secret')

Update social sign up serializer to avoid new validation on regular sign up
Update social sign up serializer to avoid new validation on regular sign up

  from django.contrib.auth import get_user_model
  from rest_framework import serializers
- from yak.rest_user.serializers import SignUpSerializer
+ from yak.rest_user.serializers import LoginSerializer
  
  User = get_user_model()
  
  
- class SocialSignUpSerializer(SignUpSerializer):
+ class SocialSignUpSerializer(LoginSerializer):
+     fullname = serializers.CharField(read_only=True)
+     username = serializers.CharField(read_only=True)
+     email = serializers.EmailField(read_only=True)
      password = serializers.CharField(required=False, write_only=True)
  
      class Meta:
          model = User
          fields = ('fullname', 'username', 'email', 'password', 'client_id', 'client_secret')
          write_only_fields = ('access_token', 'access_token_secret')
-         read_only_fields = ('fullname', 'username', 'email', 'client_id', 'client_secret')
  
Update social sign up serializer to avoid new validation on regular sign up
## Code Before:
from django.contrib.auth import get_user_model
from rest_framework import serializers
from yak.rest_user.serializers import SignUpSerializer

User = get_user_model()


class SocialSignUpSerializer(SignUpSerializer):
    password = serializers.CharField(required=False, write_only=True)

    class Meta:
        model = User
        fields = ('fullname', 'username', 'email', 'password', 'client_id', 'client_secret')
        write_only_fields = ('access_token', 'access_token_secret')
        read_only_fields = ('fullname', 'username', 'email', 'client_id', 'client_secret')

## Instruction:
Update social sign up serializer to avoid new validation on regular sign up
## Code After:
from django.contrib.auth import get_user_model
from rest_framework import serializers
from yak.rest_user.serializers import LoginSerializer

User = get_user_model()


class SocialSignUpSerializer(LoginSerializer):
    fullname = serializers.CharField(read_only=True)
    username = serializers.CharField(read_only=True)
    email = serializers.EmailField(read_only=True)
    password = serializers.CharField(required=False, write_only=True)

    class Meta:
        model = User
        fields = ('fullname', 'username', 'email', 'password', 'client_id', 'client_secret')
        write_only_fields = ('access_token', 'access_token_secret')
