class UserSerializer(serializers.Serializer):
username = Field(source='username')
email = Field(source='email')
birthday = Field(source='userprofile.birthday')
photo = Field(source='userprofile.photo.url')
And then as for the corresponding view:
from rest_framework.views import APIView
from rest_framework.response import Response
class LoadUserView(APIView):
def get(self, request, format=None):
user = self.request.user
serializer = InitMyAccountSerializer(user)
return Response(serializer.data)
With the serializer and the view about, you should get: