title: Related field id in POST request in Django Rest Framework
body: <p>I am creating the object with just only related field <code>id</code>. I have searched a lot but couldn't get the answer. Here is my code</p>
  
  <p><strong>models.py:</strong></p>
  
  <pre><code>class Resturant(models.Model):
      name = models.CharField(_('name'), max_length=100)
  
  class Menu(models.Model):
      resturant_id = models.OneToOneField(Resturant, related_name='resturant', on_delete=models.CASCADE)
      created_at = models.DateTimeField(auto_now=True)
  </code></pre>
  
  <p><strong>serializers.py:</strong></p>
  
  <pre><code>class MenuSerializer(serializers.ModelSerializer):
      resturant_id = serializers.PrimaryKeyRelatedField(read_only=True)
  
      class Meta:
          model = Menu
          fields = ['id', 'created_at', 'resturant_id']
  </code></pre>
  
  <p><strong>views.py:</strong></p>
  
  <pre><code>class CreateMenuAPIView(APIView):
  
      def post(self, request, *args, **kwargs):
          serializer = MenuSerializer(data=request.data)
          if serializer.is_valid(raise_exception=True):
              serializer.save()
              return Response(serializer.data, status=status.HTTP_200_OK)
          return Response(status=status.HTTP_400_BAD_REQUEST)
  </code></pre>
  
  <p>I am getting this error while sending <code>{ "resturant_id": 2 }</code> in POST request.</p>
  
  <pre><code>DETAIL:  Failing row contains (14, 2018-04-02 09:36:43.261849+00, null).
  The above exception (null value in column "resturant_id" violates not-null constraint
  </code></pre>
  
  <p>Any help would be appreciated !</p>