title: Django REST Framework - Serializer fails with querydict data
body: <p>I wanted to have a serializer which would read as an object of fields on a related models, but save as a pk value to the related object. Something like a nested model with <code>depth=1</code>, but with more flexibility on the nested model. Essentialy I wanted the following query structure</p>
  
  <p>GET child/{id}</p>
  
  <pre><code>{
      "id": 1,
      "name": "child",
      "parent": {
          "id": 1,
          "name": "parent"
      }
  }
  </code></pre>
  
  <p>POST child/{id}</p>
  
  <pre><code>{
      "id": 1,
      "name": "child",
      "parent": 1
  }
  </code></pre>
  
  <p>So I wrote the following serializers:</p>
  
  <pre><code># models.py
  class Parent(models.Model):
      name = models.CharField(max_length=255)
  
  
  class Child(models.Model):
      name = models.CharField(max_length=255)
      parent = models.ForeignKey(Parent)
  
  # serializers.py
  class ParentSerializer(serializers.ModelSerializer):
      """Write as pk, read as object"""
      class Meta:
          model = models.Parent
          fields = ('id', 'name')
  
      def to_internal_value(self, data):
          return self.Meta.model.objects.get(pk=data)
  
  
  class ChildSerializer(serializers.ModelSerializer):
      parent = ParentSerializer()
  
      class Meta:
          model = models.Child
          fields = ('id', 'name', 'parent')
  </code></pre>
  
  <p>This almost works as expected, but the child serializer doesn't work when passed a querydict. To illustrate the problem:</p>
  
  <pre><code># This works great! everything as expected
  parent = Parent.objects.create(name='parent')
  data = {'name': 'child', 'parent': parent.pk}
  serializer = ChildSerializer(None, data=data)
  serializer.is_valid()
  serializer.save()
  
  # This borks
  data = QueryDict('name={0}&amp;parent={1}'.format('child', parent.pk))
  serializer = ChildSerializer(None, data=data)
  serializer.is_valid()
  serializer.save()
  
  TypeError: int() argument must be a string, a bytes-like object or a number, not 'dict'
  </code></pre>
  
  <p>As a workaround I've forced <code>ChildSerializer</code> to convert QueryDicts to normal dictionaries, but I'd still like to know why the above fails and if there is a better option for this kind of API structure.</p>