title: Django serializers - add/update fields attribute value
body: <p>I'm using Django serializer for serializing the model data into JSON.<br>
  For example:- I have a model(CHECKTYPE) that contains one field 'types'.<br>
  Now 'types' contains comma(,) separated items like 'test, test1, test2'.  </p>
  
  <p>I'm using Django serializer like below (somewhere in view.py):  </p>
  
  <pre><code>gettypes = CHECKTYPE.objects.all()
  mytypes = serializers.serialize("json", gettypes)
  return HttpResponse(mytypes, content_type="application/json")
  </code></pre>
  
  <p>This returns me a JSON on web page like below:  </p>
  
  <pre><code>[{"model": "porttype.CHECKTYPE", "pk": "xyz00000005", "fields": {"types": "test, test1, test2"}}]
  </code></pre>
  
  <p>Now here I want to manipulate the fields attributes before serializing the data.<br>
  For example: I want to add one more attribute in fields 'lasttype' which will be last index of the list if I split the 'types' by comma.  </p>
  
  <pre><code>lasttype = types.split(',')[-1]
  </code></pre>
  
  <p>so final json response should look like this:   </p>
  
  <pre><code>[{"model": "porttype.CHECKTYPE", "pk": "xyz00000005", "fields": {"types": "test, test1, test2", "lasttype":"test2"}}]
  </code></pre>
  
  <p>I tried to do this like below but it's not working:</p>
  
  <pre><code>gettypes = CHECKTYPE.objects.all()
  updated_types = []
  for mtype in gettypes:
      mtype.lasttype = mtype.types.split(',')[-1]
      updated_types.append(mtype)
  mytypes = serializers.serialize("json", updated_types)
  return HttpResponse(mytypes, content_type="application/json")
  </code></pre>
  
  <p>But this is not working. It's giving me same JSON response and not showing the 'lasttype' attribute.
  Please let me know if there is any possibility to achieve this.</p>
  
  <p>Thanks,<br>
  Shashank</p>