tomchristie/django-rest-framework — pull request #257 by mjumbewu (2012-09-08 22:50:05+00:00)
Title: Resources and routers

Implement routers and resources according to the documentation, with some slight modifications. See [the modified tutorial 6](https://github.com/mjumbewu/django-rest-framework/blob/resources-and-routers/docs/tutorial/6-resource-orientated-projects.md) for details.

The usage is meant to be a little reminiscent of the process of registering models for the Admin.

## Example:

*resources.py*

from djangorestframework.routers import DefaultResourceRouter
from myapp.models import BlogPost, Comment

api = DefaultResourceRouter()
api.register(BlogPost)
api.register(Comment)

*urls.py*

from django.conf.urls.defaults import url, patterns, include
from myapp.resources import api

urlpatterns = patterns('',
url(r'^api/', include(api.urls, namespace='myapp')),
url(r'^auth/', include('djangorestframework.urls', namespace='djangorestframework'))
)