title: How to post data in nested serializer using id field
body: <p>I'm trying to post data in nested serializer using only <code>id</code> field, but it does not work.</p>
  <p>This project is for making orders in restaurants</p>
  <h2>What i want to see</h2>
  <p>Here is how i push data:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;is_done&quot;: false,
      &quot;dishes&quot;: [
          {&quot;dish&quot;:1}
      ]
  }
  </code></pre>
  <p>The GET request looks like this:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;id&quot;: 14,
      &quot;is_done&quot;: false,
      &quot;dishes&quot;: [
          {
              &quot;dish&quot;: 1,
              &quot;quantity&quot;: 1
          }
      ]
  }
  </code></pre>
  <p>But I want to see it like this</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;id&quot;: 14,
      &quot;is_done&quot;: false,
      &quot;dishes&quot;: [
          {
              &quot;dish&quot;: {
                  &quot;id&quot;: 1,
                  &quot;name&quot;: &quot;Simple dish 1&quot;,
                  &quot;price&quot;: &quot;200.00&quot;
              },
              &quot;quantity&quot;: 1
          }
      ]
  }
  </code></pre>
  <h2>Here is my python code</h2>
  <p>OrderItemSerializer <br>
  OrderSerializer</p>
  <pre class="lang-py prettyprint-override"><code>class OrderItemSerializer(serializers.ModelSerializer):
      class Meta:
          model = OrderItem
          fields = (
              'dish',
              'quantity',
          )
  
  
  class OrderSerializer(serializers.ModelSerializer):
      dishes = OrderItemSerializer(many=True, read_only=False)
  
      class Meta:
          model = Order
          fields = (
              'id',
              'is_done',
              'dishes',
              # 'created_at',
              # 'updated_at',
          )
  
      def create(self, validated_data):
          order_items = validated_data.pop('dishes')
          order = Order.objects.create(**validated_data)
          for dish in order_items:
              OrderItem.objects.create(order=order, **dish)
          return order
      
      def update(self, instance, validated_data):
          order_items = validated_data.pop('dishes')
  
          instance.is_done = validated_data.get('is_done', instance.is_done)
          instance.save()
  
          for dish in order_items:
              order_item = OrderItem.objects.get(order=instance)
              order_item.dish = dish['dish']
              order_item.quantity = dish['quantity']
              order_item.save()
  
          return instance
  </code></pre>
  <h3>Models</h3>
  <pre class="lang-py prettyprint-override"><code>class Order(models.Model):
      is_done = models.BooleanField(default=False)
      created_at = models.DateTimeField(auto_now_add=True)
      updated_at = models.DateTimeField(auto_now=True)
  
      class Meta:
          verbose_name = 'Заказ'
          verbose_name_plural = 'Заказы'
  
  
  class OrderItem(models.Model):
      order = models.ForeignKey(Order, related_name='dishes',
                                on_delete=models.CASCADE)
      dish = models.ForeignKey(Dish, on_delete=models.CASCADE)
      quantity = models.IntegerField(default=1)
  </code></pre>