diff options
| author | tom christie tom@tomchristie.com | 2011-01-30 18:30:39 +0000 |
|---|---|---|
| committer | tom christie tom@tomchristie.com | 2011-01-30 18:30:39 +0000 |
| commit | 42f2f9b40d1295e18a5b720b0d1f6ad85e928d8a (patch) | |
| tree | 458f97992bcd1348a413d21a5925f933ba7f74e3 /docs/index.rst | |
| parent | 8a470f031eeccf45625c3e3e18a8743021b38d41 (diff) | |
| download | django-rest-framework-42f2f9b40d1295e18a5b720b0d1f6ad85e928d8a.tar.bz2 | |
Rename to django-rest-framework, get simpleexample working
Diffstat (limited to 'docs/index.rst')
| -rw-r--r-- | docs/index.rst | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/docs/index.rst b/docs/index.rst index 7a871a5c..7da3f017 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -26,10 +26,10 @@ Requirements Installation & Setup -------------------- -The django-rest-framework project is hosted as a `mercurial repository on bitbucket <https://bitbucket.org/tomchristie/flywheel>`_. +The django-rest-framework project is hosted as a `mercurial repository on bitbucket <https://bitbucket.org/tomchristie/django-rest-framework>`_. To get a local copy of the repository use mercurial:: - hg clone https://tomchristie@bitbucket.org/tomchristie/flywheel + hg clone https://tomchristie@bitbucket.org/tomchristie/django-rest-framework To add django-rest-framework to a django project: @@ -43,27 +43,15 @@ Getting Started Often you'll want parts of your API to directly map to existing Models. At it's simplest this looks something like this... -``views.py``:: +``urls.py`` - from djangorestframework.modelresource import ModelResource, ModelRootResource - from models import MyModel +.. include:: ../examples/simpleexample/urls.py + :literal: - class MyModelRootResource(ModelRootResource): - """A create/list resource for MyModel.""" - allowed_methods = ('GET', 'POST') - model = MyModel +``views.py`` - class MyModelResource(ModelResource): - """A read/update/delete resource for MyModel.""" - allowed_methods = ('GET', 'PUT', 'DELETE') - model = MyModel - -``urls.py``:: - - urlpatterns += patterns('myapp.views', - url(r'^mymodel/$', 'MyModelRootResource'), - url(r'^mymodel/([^/]+)/$', 'MyModelResource'), - ) +.. include:: ../examples/simpleexample/views.py + :literal: Examples |
