title: Output of values() on a QuerySet with ManyToMany fields
body: <p>I'm currently placing the result of a QuerySet into a JSON string to be used by my js frontend.</p>
  
  <p>Currently this is easy enough using .values() and simplejson:</p>
  
  <pre><code>simplejson.dumps(list(Task.objects.filter(list=mylist).values()))
  </code></pre>
  
  <p>I've now added a ManyToMany field in my Task object, would like to have it included in my output without having each Task object repeated for every value of the ManyToMany relationship.</p>
  
  <p>If I just did <code>Task.objects.filter(list=mylist).values('myManyToManyField', 'someOtherField')</code>  The output would have a separate object/row for each value of <code>myManyToManyField</code></p>
  
  <pre><code>[{'myManyToManyField': 1, 'someOtherField': 'valueOne'}, 
  {'myManyToManyField': 2, 'someOtherField': 'valueOne'},
  {'myManyToManyField': 1, 'someOtherField': 'valueTwo'}]
  </code></pre>
  
  <p>Is there any way to get this result instead?:</p>
  
  <pre><code>[{'myManyToManyField': [1,2], 'someOtherField': 'valueOne'},
  {'myManyToManyField': 1, 'someOtherField': 'valueTwo'}]
  </code></pre>
  
  <p>The only solution I have right now is to loop over all the <code>Task</code> objects and build the output manually, placing the ManyToMany value within it as desired. Is there a better way to do this? If not - would this be horribly inefficient? </p>