          model = OneToOneSource
          exclude = ('target_source', )
  
  
  class OneToOneTargetSourceSerializer(serializers.ModelSerializer):
      source = OneToOneSourceSerializer()
  
      class Meta:
          model = OneToOneTargetSource
          exclude = ('target', )
  
  
  class OneToOneTargetSerializer(serializers.ModelSerializer):
      target_source = OneToOneTargetSourceSerializer()
  
 
</s> remove class OneToOneTargetSerializer(serializers.ModelSerializer):
    target_source = OneToOneTargetSourceSerializer()
 </s> add         class OneToOneTargetSerializer(serializers.ModelSerializer):
            source = OneToOneSourceSerializer() </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 Meta:
        model = OneToOneTarget
 </s> add             class Meta:
                model = OneToOneTarget
                fields = ('id', 'name', 'source') </s> remove     def test_one_to_one_delete(self):
        data = {'id': 3, 'name': 'target-3', 'target_source': None}
        instance = OneToOneTarget.objects.get(pk=3)
        serializer = OneToOneTargetSerializer(instance, data=data)
 </s> add class ForwardNestedOneToOneTests(TestCase):
    def setUp(self):
        class OneToOneTargetSerializer(serializers.ModelSerializer):
            class Meta:
                model = OneToOneTarget
                fields = ('id', 'name')

        class OneToOneSourceSerializer(serializers.ModelSerializer):
            target = OneToOneTargetSerializer()

            class Meta:
                model = OneToOneSource
                fields = ('id', 'name', 'target')

        self.Serializer = OneToOneSourceSerializer

        for idx in range(1, 4):
            target = OneToOneTarget(name='target-%d' % idx)
            target.save()
            source = OneToOneSource(name='source-%d' % idx, target=target)
            source.save()

    def test_one_to_one_retrieve(self):
        queryset = OneToOneSource.objects.all()
        serializer = self.Serializer(queryset)
        expected = [
            {'id': 1, 'name': 'source-1', 'target': {'id': 1, 'name': 'target-1'}},
            {'id': 2, 'name': 'source-2', 'target': {'id': 2, 'name': 'target-2'}},
            {'id': 3, 'name': 'source-3', 'target': {'id': 3, 'name': 'target-3'}}
        ]
        self.assertEqual(serializer.data, expected)

    def test_one_to_one_create(self):
        data = {'id': 4, 'name': 'source-4', 'target': {'id': 4, 'name': 'target-4'}}
        serializer = self.Serializer(data=data)
          model = OneToOneSource
          exclude = ('target_source', )
  
  






  
  
  class OneToOneTargetSerializer(serializers.ModelSerializer):
      target_source = OneToOneTargetSourceSerializer()
  
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