title: Python - Unable to modify the serializer.data dictionary in Django Rest Framework
body: <p>I have tried to add a key <code>serializer.data['test'] = 'asdf'</code>, this does not appear to do anything.</p>
  
  <p>I want to transform the representation of a key's value. To do this, I'm trying to use the value to calculate a new value and replace the old one in the dictionary.</p>
  
  <p>This is what I want to accomplish, but I don't know why the value is not being replaced. There are no errors thrown, and the resulting dictionary has no evidence that I've tried to replace anything:</p>
  
  <pre><code>class PlaceDetail(APIView):
      def get(self, request, pk, format=None):
          place = Place.objects.select_related().get(pk=pk)
          serializer = PlaceSerializer(place)
          #serializer.data['tags'] = pivot_tags(serializer.data['tags'])
          serializer.data['test'] = 'asdf'
          print(serializer.data['test'])
          return Response(serializer.data)
  </code></pre>
  
  <p>Terminal: <code>KeyError: 'test'</code></p>
  
  <p>I have observed by printing that <code>serializer.data</code> is a dictionary.</p>
  
  <p>I have also tested that the syntax I'm trying to use should work:</p>
  
  <pre><code>&gt;&gt;&gt; test = {'a': 'Alpha'}
  &gt;&gt;&gt; test
  {'a': 'Alpha'}
  &gt;&gt;&gt; test['a']
  'Alpha'
  &gt;&gt;&gt; test['a'] = 'asdf'
  &gt;&gt;&gt; test
  {'a': 'asdf'}
  </code></pre>
  
  <p>How can I properly modify the <code>serializer.data</code> dictionary?</p>