  class OneToOneTarget(models.Model):
      name = models.CharField(max_length=100)
  
  
  class OneToOneTargetSource(models.Model):
      name = models.CharField(max_length=100)
      target = models.OneToOneField(OneToOneTarget, null=True, blank=True,
                                    related_name='target_source')
  
  
  class OneToOneSource(models.Model):
      name = models.CharField(max_length=100)
      target_source = models.OneToOneField(OneToOneTargetSource, related_name='source')
  
  
 
</s> remove     target_source = models.OneToOneField(OneToOneTargetSource, related_name='source')


class OneToOneSourceSerializer(serializers.ModelSerializer):
    class Meta:
        model = OneToOneSource
        exclude = ('target_source', )

 </s> add     target = models.OneToOneField(OneToOneTarget, related_name='source') </s> remove class NestedOneToOneTests(TestCase):
    def setUp(self):
 </s> add  </s> remove class OneToOneTargetSerializer(serializers.ModelSerializer):
    target_source = OneToOneTargetSourceSerializer()
 </s> add         class OneToOneTargetSerializer(serializers.ModelSerializer):
            source = OneToOneSourceSerializer() </s> remove class OneToOneTargetSourceSerializer(serializers.ModelSerializer):
    source = OneToOneSourceSerializer()

    class Meta:
        model = OneToOneTargetSource
        exclude = ('target', )
 </s> add 
  class OneToOneTarget(models.Model):
      name = models.CharField(max_length=100)
  
  






  class OneToOneSource(models.Model):
      name = models.CharField(max_length=100)
      target_source = models.OneToOneField(OneToOneTargetSource, related_name='source')
  
  
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 Cleanup one-one nested tests and implementation 
rest_framework/tests/relations_nested.py