I’ve updated the django-restful-model-views contribution, based on feedback I’ve received, primarily to make this a more generic REST API (not just model based). This update also begins implementing some ideas borrowed from Ruby on Rails. I have reproduced the changelog here for convenience:
- added extra checks to restful_urls.py in case there is not RESTFUL_APPS setting.
- extracted Resources and Resources.Resources_Member classes. Model based resources now implement these classes. This allows for building resources that are not model based as well as those that are.
- created corresponding ResourceDispatcher -> ModelResourceDispatcher class hierarchy.
- updated the code to account for clients that can send direct put and delete methods on resource members.
- The hidden ‘_action’ post field name has been changed to ‘_method’, as Ruby on Rails does.
- updated the unit tests and documentation accordingly and did some general tidying.
I also feel obliged to point to a blog post that I suspect many people may not have seen: Improving Django: Generic views for RESTful web services. The author’s proposal is very close to what I proposed in my last blog post on the subject, Evolving a RESTful Django Contribution, but he goes much further, proposing specific approaches for how to configure a more generalized ReST API for resources that are not mapped to models and also goes further than I have in thinking about how to respond to requests in different formats. As I’ve said before, things move quickly in the Django community, and the work around ReST could become a very exciting area. Because our ideas seem so close, and because I already have some working code that addresses things like organizing view code and dispatching requests while the author has a design for a fully realized ReST API, I’ve suggested to the author that our work would be a natural fit and that we should collaborate on the final contribution. Stay tuned.