title: Django REST Framework different depth for POST/PUT?
body: <p>I am using Django REST Framework to create an API for my web app. I have a class 'Comment', that has <code>depth=2</code> set in the <code>Meta</code> class. This works great when <code>GET</code>ing the <code>Comments</code>. When I try to send a <code>POST</code> or <code>PUT</code> request though (i.e. create a new <code>Comment</code>) I am told I need to include objects instead of ForeignKey IDs. </p>
  
  <p>Here's my Serializer class:</p>
  
  <pre><code>class CommentSerializer(serializers.ModelSerializer):
      class Meta:
          model = Comment
          depth = 2 
  </code></pre>
  
  <p>The model:</p>
  
  <pre><code>class Comment(models.Model):
      user = models.ForeignKey(User, null=True, blank=True,
          related_name='comments')
      budget = models.ForeignKey(Budget, related_name='comments')
      published = models.BooleanField(default=False)
      body = models.TextField()
      created = models.DateTimeField(auto_now_add=True)
  </code></pre>
  
  <p>The view code:</p>
  
  <pre><code>class Comments(generics.ListCreateAPIView):
  
      model = Comment
      serializer_class = CommentSerializer
  
      def pre_save(self, obj):
          obj.user = self.request.user
  </code></pre>
  
  <p>And the error that is displayed in the output (JSON) is:</p>
  
  <pre><code>{"user": ["This field is required."], "budget": [{"non_field_errors": ["Invalid data"]}]}
  </code></pre>
  
  <p>When this raw data is sent:</p>
  
  <pre><code>{"budget": 2, "published": true, "body": "Another comment"}
  </code></pre>