title: DjangoRestFramework: How to modify response provided by ModelViewSet?
body: <p>I am writing a server with django rest framework.
  Basically the ModelViewSet is working great. It generally respond a json like:</p>
  
  <pre><code>[{object1}, {object2}]
  </code></pre>
  
  <p>or</p>
  
  <pre><code>{object}
  </code></pre>
  
  <p>or with error</p>
  
  <pre><code>{"detail": error}
  </code></pre>
  
  <p>but now, I want the response to be like:</p>
  
  <pre><code>{"code": code, "data": [{object1}, {object2}]}
  </code></pre>
  
  <p>or</p>
  
  <pre><code>{"code": code, "data": {object}}
  </code></pre>
  
  <p>or with error</p>
  
  <pre><code>{"code": code}
  </code></pre>
  
  <p>To display a response code, and put the actual data in the data field.How can I do that?</p>