From 42f2f9b40d1295e18a5b720b0d1f6ad85e928d8a Mon Sep 17 00:00:00 2001 From: tom christie tom@tomchristie.com Date: Sun, 30 Jan 2011 18:30:39 +0000 Subject: Rename to django-rest-framework, get simpleexample working --- docs/conf.py | 2 +- docs/index.rst | 28 ++++++++-------------------- docs/requirements.txt | 8 ++++++++ 3 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 docs/requirements.txt (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index 71cacb3d..3689a636 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,7 @@ import sys, os sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) -sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'flywheel')) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'djangorestframework')) sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'examples')) import settings from django.core.management import setup_environ 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 `_. +The django-rest-framework project is hosted as a `mercurial repository on bitbucket `_. 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 diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..77cdf485 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,8 @@ +# Documentation requires Django & Sphinx, and their dependencies... + +Django==1.2.4 +Jinja2==2.5.5 +Pygments==1.4 +Sphinx==1.0.7 +docutils==0.7 +wsgiref==0.1.2 -- cgit v1.2.3