diff options
Diffstat (limited to 'docs/index.rst')
| -rw-r--r-- | docs/index.rst | 83 |
1 files changed, 69 insertions, 14 deletions
diff --git a/docs/index.rst b/docs/index.rst index 10e41f7a..a7058ed4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,9 +1,9 @@ -FlyWheel Documentation -====================== +Django REST framework +===================== -This is the online documentation for FlyWheel - A REST framework for Django. +A lightweight REST framework for Django. -Some of FlyWheel's features: +Features: * Clean, simple, class-based views for Resources. * Support for ModelResources with nice default implementations and input validation. @@ -16,21 +16,76 @@ Some of FlyWheel's features: Installation & Setup -------------------- -blah di blah +The django-rest-framework project is hosted as a `mercurial repository on bitbucket <https://bitbucket.org/tomchristie/flywheel>`_. +To get a local copy of the repository use mercurial:: + + hg clone https://tomchristie@bitbucket.org/tomchristie/flywheel + +To add django-rest-framework to a django project: + +* Copy or symlink the ``djangorestframework`` directory into python's ``site-packages`` directory, or otherwise ensure that the ``djangorestframework`` directory is on your ``PYTHONPATH``. +* Add ``djangorestframework`` to your ``INSTALLED_APPS``. +* Ensure the ``TEMPLATE_LOADERS`` setting contains the item ``'django.template.loaders.app_directories.Loader'``. (It will do by default, so you shouldn't normally need to do anything here.) Getting Started --------------- -Blah di blah +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``:: + + from djangorestframework.modelresource import ModelResource, ModelRootResource + from models import MyModel + + class MyModelRootResource(ModelRootResource): + """A create/list resource for MyModel.""" + allowed_methods = ('GET', 'POST') + model = MyModel + + 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'), + ) Examples -------- -Blah blah blah, examples here. +There's a few real world examples included with django-rest-framework. +These demonstrate the following use cases: + +#. Using :class:`.Resource` for resources that do not map to models. +#. Using :class:`.Resource` with forms for input validation. +#. Using :class:`.ModelResource` for resources that map directly to models. + +All the examples are freely available for testing in the sandbox here: http://api.django-rest-framework.org + +.. toctree:: + :maxdepth: 1 + + examples/objectstore + examples/pygments + examples/blogpost + +How Tos +------- + +.. toctree:: + :maxdepth: 2 + + howto/usingcurl -Add a toctree for examples +.. note:: + TODO Library Reference ----------------- @@ -38,12 +93,12 @@ Library Reference .. toctree:: :maxdepth: 2 - resource - modelresource - emitters - parsers - authenticators - response + library/resource + library/modelresource + library/emitters + library/parsers + library/authenticators + library/response Indices and tables |
