'DRF how to update, create OneToOneField in serializers?

I have two models, with OnetoOne field. How can I update/create them with help of serializers?

class Page(models.Model):
 info = models.TextField(null=True, blank=True)
 document = models.OneToOneField(
        Document,
        primary_key=True,
        related_name='page',
        on_delete=models.CASCADE)


class Document(models.Model)
      description = models.TextField(null=True, blank=True)
      note = models.TextField(null=True, blank=True)

My serializer

class PageSerializer(ModelSerializer):
      document = DocumentSerializer()
    
      class Meta:
         model = Page 
         fields = ('document', 'info')


def update:

def create:


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source