title: Django Serializer Save models with foreign key relationships
body: <p>I am trying to save a model object that has a foreign key referencing another table. Trying to write the serializer for the same, however can't wrap my head around how to do it and can't seem to find the right documentation either. My model objects:</p>
  
  <pre><code>class Restaurant(models.Model):
  
      name = models.CharField(null=False, max_length=255)
      min_order = models.CharField(null=False, max_length=255)
      # And so on
  
  class RMenuCategory(models.Model):
  
      category_name = models.CharField(null=False, max_length=255)
      restaurant = models.ForeignKey('Restaurant')
  </code></pre>
  
  <p>My serializer class for <code>RMenuCategory</code> model: </p>
  
  <pre><code>class RestaurantMenuSerializer(serializers.ModelSerializer):
  
      restaurant = serializers.PrimaryKeyRelatedField()
  
      class Meta:
          model = RMenuCategory
          fields = ('id', 'category_name', 'restaurant')
  </code></pre>
  
  <p>Making the api call with the json as: </p>
  
  <pre><code>{ "category_name" : "Italian", "restaurant_id" : 4}
  </code></pre>
  
  <p>This is not working when I try out the following in my view: </p>
  
  <pre><code>menu_cat = RestaurantMenuSerializer(data=data)
          if menu_cat.is_valid():
              category = menu_cat.save()
          else:
              exit()
  </code></pre>