jrief/django-angular — pull request #37 by merll (2014-04-24 13:47:54+00:00)
Title: Error handling in JSONResponseMixin and CRUD view

Catching `ValueError` (introduced in `NgCRUDView` with my earlier PR #25) applies to many errors from individual code. These probably should -- as other unexpected situations -- result in a HTTP 500 error responses, rather than being mixed with Djangular's defined HTTP 4xx messages. Therefore my changes introduce more specific exception subclasses. Additionally there is a new subclass `JSONResponseException`, which could be used by developers for JSON-encoding custom HTTP 4xx responses during error handling.
The separation between serialization and JSON-encoding should also make it easier to customize the serialization process in subclasses, e.g. adding extra information to the response.

It seemed that duplicate code was building up for the JSON response, along with `JSONResponseMixin`; I suggest to consolidate this in a base mixin class.

For working with content types, I added an option for serializing natural keys to the CRUD view, as suggested in the [Django docs](https://docs.djangoproject.com/en/stable/topics/serialization/#natural-keys).

All of this is based on *jrief:rmi*, in order to avoid conflicts with the latest progress there.