from rest_framework import serializers
from django.contrib.auth.models import User
from login.models import UserProfile

class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ('id', 'username', 'email', 'password')
        write_only_fields = ('password',)
        read_only_fields = ('id',)


class UserProfileSerializer(serializers.ModelSerializer):
    class Meta:
        model = UserProfile
        fields = ('id', 'first_name', 'last_name', 'designation', 'profile_image')
        read_only_fields = ('id',)

@@ -336,16 +336,241 @@
 ('id',)%0A
+    %0A    def create(self, validated_data):%0A        user = User(email=validated_data%5B'email'%5D, username=validated_data%5B'username'%5D)%0A        user.set_password(validated_data%5B'password'%5D)%0A        user.save()%0A        return user%0A
 %0A%0Aclass 

Fix saving passwords in Register API