I have a Django form which I\'m validating in a normal Django view. I\'m trying to figure out how to extract the pure errors (without the HTML formatting). Below is the code
Got it after a lot of messing around, testing different things. N.B. I'm not sure whether this works with internationalization as well. This also takes the first validation error for each field, but modifying it to get all of the errors should be rather easy.
return json_response({ 'success' : False,
'errors' : [(k, v[0].__unicode__()) for k, v in form.errors.items()] })