  
  
  class OneToOneSource(models.Model):
      name = models.CharField(max_length=100)
      target_source = models.OneToOneField(OneToOneTargetSource, related_name='source')
  
  
  class OneToOneSourceSerializer(serializers.ModelSerializer):
      class Meta:
          model = OneToOneSource
          exclude = ('target_source', )
  
  
  class OneToOneTargetSourceSerializer(serializers.ModelSerializer):
      source = OneToOneSourceSerializer()
  
      class Meta:
 
</s> remove class OneToOneTargetSourceSerializer(serializers.ModelSerializer):
    source = OneToOneSourceSerializer()

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


 </s> add  </s> remove class OneToOneTargetSerializer(serializers.ModelSerializer):
    target_source = OneToOneTargetSourceSerializer()
 </s> add         class OneToOneTargetSerializer(serializers.ModelSerializer):
            source = OneToOneSourceSerializer() </s> remove     class Meta:
        model = OneToOneTarget
 </s> add             class Meta:
                model = OneToOneTarget
                fields = ('id', 'name', 'source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
  
  
  class OneToOneSource(models.Model):
      name = models.CharField(max_length=100)
    target = models.OneToOneField(OneToOneTarget, related_name='source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
    target = models.OneToOneField(OneToOneTarget, related_name='source')
  
  class OneToOneTargetSourceSerializer(serializers.ModelSerializer):
      source = OneToOneSourceSerializer()
  
      class Meta:
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 Cleanup one-one nested tests and implementation 
rest_framework/tests/relations_nested.py