kevin-brown/drf-json-api — pull request #11 by jwhitlock (2014-09-03 16:46:37+00:00)
Title: Refactor parser and renderer for extensibility

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.

I don't think #7 is done yet. I had some further ideas (`field_to_attribute_name`, converting the `isinstance` logic in `convert_resource` to another iteration), but I wanted to write tests, and to get your feedback on the changes so far.