You just need to define a serializer for each and attach one to the other, as shown below:
from rest_framework.serializers import ModelSerializer class UserSerializer(ModelSerializer): """ A serializer for ``User``. """ class Meta(object): model = User class UserProfileSerializer(ModelSerializer): """ A serializer for ``UserProfile``. """ user = UserSerializer() class Meta(object): model = UserProfile
You can then use the UserProfileSerializer to update (or perform other actions) the user profile and its user instance.
source share