title: Updating related objects django rest framework
body: <p>In my django project, I have 2 relevant models:</p>
  <pre class="lang-py prettyprint-override"><code>class User(AbstractUser):
      email = models.EmailField(
          verbose_name='e-mailaddress',
          max_length=255,
          unique=True)
      # other props not important
          
  class Profile(models.Model):
      user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
      #other props not important
  </code></pre>
  <p>For both creating and retrieving, it is convenient to have User as a nested object in the serializer:</p>
  <pre class="lang-py prettyprint-override"><code>class ProfileSerializer(serializers.ModelSerializer):
      user = UserSerializer()
      class Meta:
          model = Profile
          fields = '__all__'
  
      def create(self, validated_data):
          user_data = validated_data.pop('user')
          user = User.objects.create(**user_data)
          user.save()
          # because of reasons, an empty profile is created on initial save. This works, trust me
          d, _ = Profile.objects.update_or_create(user=user, defaults=validated_data)
          d.save()
          return d
  </code></pre>
  <p>HOWEVER. One action that I want to be possible as well is to update both properties of the Profile and the User at the same time. When doing this with my serializer, <code>serializer.is_valid()</code> fails as the provided email is already present in the database. This also indicates that, even if the validation passes (i.e. because of an updated email address), a new User object will be created and coupled to the Profile. So my question is:</p>
  <p><strong>How do I make the validation of a serializer check if the <em>edit</em> of a nested object is valid rather than checking if a new one can be created?</strong></p>