class InformationSerializer(serializers.ModelSerializer):
    owner=serializers.StringRelatedField(read_only=True)
    class Meta:
        model=Information
        fields=['id', 'owner', 'title', 'content', 'created_at']


class RegisterSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ('id','first_name', 'last_name','username', 'email', 
'password')
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = 
User.objects.create_user(first_name=validated_data['first_name'],last_name=validated_data['last_name'],username=validated_data['username'],
 
email=validated_data['email'], password=validated_data['password'])

        return user



in models owner is related to information using forignKey 
can anyone help me solving this error?

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/265131ac-a4b0-4574-bf60-cc53d46defb2n%40googlegroups.com.

Reply via email to