title: Validation codes and messages in Django Rest Framework
body: <p>Using out of the box fields in a serializer, validation error messages look something like this:</p>
  
  <pre><code>{
      "product": [
          "This field must be unique."
      ],
      "price": [
          "This field is required."
      ]
  }
  </code></pre>
  
  <p>However, for the API I am writing, I would like to provide a unique error code for each failed validation, so that clients can programmatically respond to validation errors, or can provide their own custom messages in a UI.  Ideally the error json would look something like this:</p>
  
  <pre><code>{
      "product": [
          {
            "code": "unique",
            "message": "This field must be unique."
          }
      ],
      "price": [
          { 
            "code": "required",
            "message": "This field is required."
          }
      ]
  }
  </code></pre>
  
  <p>The current approach using ValidationErrors makes this rather difficult.  Looking through the code, it seems as though this type of error reporting is not supported currently.  However, I'm looking for an approach to override the error handling to fit this model.</p>