kevin-brown/drf-json-api — pull request #12 by jwhitlock (2014-09-05 01:53:47+00:00)
Title: Refactor parser and renderer for extensibility

This is a re-write of PR #11, to address the issues in #7 but without picking a conversion for multi-word resource names.

There are quite a few changes to the code, which makes the full diff useless for seeing what happened. I didn't change any tests (all pass). The changes are:

- Functions have been moved to class methods, so that users can override specific methods in derived classes.
- `renderers.JsonApiMixin.renderer` now iterates through wrapper methods by name, stopping when it finds a suitable wrapper and raising an exception if none are suitable. Users can override an existing wrapper, or add their own.
- Instead of a plain `dict`, a User can specify a different dict-like objects (`SortedDict`, `OrderedDict`) by overriding `renders.JsonApiMixin.wrapper_class`.
- Utility functions are called through class methods, so a user can choose a different algorithm.
- `utils.model_to_resource_type` changed to replace spaces with dashes.