title: Serializing optionally nested structures: Difference between QueryDict and normal dict?
body: <p>I'm running into weird behavior when writing nested structures with django-rest and then trying to test them using django-rest's test client. The nested child object should be optional. </p>
  
  <p>Here's a sample serializer:</p>
  
  <pre><code>from rest_framework import serializers
  
  class OptionalChildSerializer(serializers.Serializer):
      field_b = serializers.IntegerField()
      field_c = serializers.IntegerField()
  
      class Meta:
          fields = ('field_b', 'field_c', )
  
  class ParentSerializer(serializers.Serializer):
      field_a = serializers.IntegerField()
      child = OptionalChildSerializer(required=False, many=False)
  
      class Meta:
          fields = ('a', 'child',)
  
      def perform_create(self, serializer):
          # TODO: create nested object.
          pass
  </code></pre>
  
  <p>(I've omitted the code in perform_create, as it's not relevant to the question).</p>
  
  <p>Now, passing a normal dict as data argument works just fine:</p>
  
  <pre><code>ser = ParentSerializer(data=dict(field_a=3))
  ser.is_valid(raise_exception=True)
  </code></pre>
  
  <p>But passing a QueryDict instead will fail:</p>
  
  <pre><code>from django.http import QueryDict
  ser = ParentSerializer(data=QueryDict("field_a=3"))
  ser.is_valid(raise_exception=True)
  
  ValidationError: {'child': {'field_b': [u'This field is required.'], 'field_c': [u'This field is required.']}}
  </code></pre>
  
  <p>On the actual web site, the API gets a normal dict and thus works fine. During testing however, using something like <code>client.post('url', data=dict(field_a=3))</code> will result in a QueryDict being passed to the view, and hence not work.</p>
  
  <p>So my question is: what's the difference between the QueryDict and normal dict? Or am I approaching this the wrong way?</p>