tomchristie/django-rest-framework — pull request #262 by tomchristie (2012-09-15 19:24:58+00:00)
Title: Move content negotiation out of response.

Tests not yet all passing, but basically looking good.

1. Logic is cleaner. In particular because conneg happens in the view, we don't need to awkwardly deal with the NotAcceptable exception having to be dealt with at the time of rendering the response.
2. Easier to override conneg behavior for users.
3. Easier to override exception behaviour. All exceptions dealt with in single place now.
4. Easy to use different code paths for different formats (eg serialize differently for different media types.)
Eg `if self.renderer.format == 'json' ...` inside APIView