Now that we've got some models and a urlconf, there's very little code to write. We'll create a :class:`.ModelResource` to map to instances of our models, and a top level :class:`.RootModelResource` to list the existing instances and to create new instances.
And we're done. We've now got a fully browseable API, which supports multiple input and output media types, and has all the nice automatic field validation that Django gives us for free.
And we're done. We've now got a fully browseable API, which supports multiple input and output media types, and has all the nice automatic field validation that Django gives us for free.
@@ -70,29 +70,23 @@ For more information on settings take a look at the :ref:`setup` section.
...
@@ -70,29 +70,23 @@ For more information on settings take a look at the :ref:`setup` section.
Getting Started
Getting Started
---------------
---------------
Using Django REST framework can be as simple as adding a few lines to your urlconf and adding a `permalink <http://docs.djangoproject.com/en/dev/ref/models/instances/#get-absolute-url>`_ to your model.
Using Django REST framework can be as simple as adding a few lines to your urlconf.
`urls.py`::
``urls.py``::
from django.conf.urls.defaults import patterns, url
from django.conf.urls.defaults import patterns, url
from djangorestframework import ModelResource, RootModelResource
from djangorestframework.resources import ModelResource
from models import MyModel
from djangorestframework.views import ListOrCreateModelView, InstanceModelView