title: Serializing an array of data on the basis of foreign key django rest framework
body: <p>I am using django rest framework to post property_id in favorites table as a foreign key and on the basis of foreign key i want to get all fields from property table.</p>
  
  <pre><code>class Favorites(models.Model):
      """Store favorite property"""
  
      user_id = models.ForeignKey(User, on_delete=models.CASCADE)
      property_id = models.ForeignKey(Property, on_delete=models.CASCADE)
      created_at = models.DateTimeField(auto_now_add=True, blank=True)
  </code></pre>
  
  <p>Serializer:</p>
  
  <pre><code>class FavoriteSerializer(serializers.ModelSerializer):
      """Favorite Properties serializer"""
  
      class Meta:
          model = Favorites
          fields = ('user_id','property_id', )
  </code></pre>
  
  <p>Viewset:</p>
  
  <pre><code>class FavoriteViewSet(viewsets.ModelViewSet):
  
      http_method_names = ['get','post' ]
      serializer_class = FavoriteSerializer
      queryset = Favorites.objects.all()
  </code></pre>
  
  <p>Output:
  <a href="https://i.stack.imgur.com/vuexV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vuexV.png" alt="enter image description here"></a></p>
  
  <p>This is my first output. then i sync my property Serializer and get this one:</p>
  
  <p><a href="https://i.stack.imgur.com/bJohp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bJohp.png" alt="enter image description here"></a></p>
  
  <p>This is the output i need but it creates problem during post. During post i only need user_id and property_id but it makes my post form like this:</p>
  
  <p><a href="https://i.stack.imgur.com/4xWDA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4xWDA.png" alt="enter image description here"></a></p>
  
  <p>Any suggestions how i can achieve my results?</p>