diff options
Diffstat (limited to 'docs/index.rst')
| -rw-r--r-- | docs/index.rst | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/docs/index.rst b/docs/index.rst index 3b4e9c49..8a285271 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -30,15 +30,11 @@ Resources * The ``djangorestframework`` package is `available on PyPI <http://pypi.python.org/pypi/djangorestframework>`_. * We have an active `discussion group <http://groups.google.com/group/django-rest-framework>`_ and a `project blog <http://blog.django-rest-framework.org>`_. -* Bug reports are handled on the `issue tracker <https://bitbucket.org/tomchristie/django-rest-framework/issues?sort=version>`_. -* There is a `Jenkins CI server <http://datacenter.tibold.nl/job/djangorestframework/>`_ which tracks test status and coverage reporting. (Thanks Marko!) -* Get with in touch with `@thisneonsoul <https://twitter.com/thisneonsoul>`_ on twitter. +* Bug reports are handled on the `issue tracker <https://github.com/tomchristie/django-rest-framework/issues>`_. +* There is a `Jenkins CI server <http://jenkins.tibold.nl/job/djangorestframework/>`_ which tracks test status and coverage reporting. (Thanks Marko!) Any and all questions, thoughts, bug reports and contributions are *hugely appreciated*. -We'd like for this to be a real community driven effort, so come say hi, get involved, and get forking! (See: `Forking a Bitbucket Repository -<http://confluence.atlassian.com/display/BITBUCKET/Forking+a+Bitbucket+Repository>`_, or `Fork A GitHub Repo <http://help.github.com/fork-a-repo/>`_) - Requirements ------------ @@ -46,8 +42,8 @@ Requirements * Django (1.2, 1.3 supported) -Installation & Setup --------------------- +Installation +------------ You can install Django REST framework using ``pip`` or ``easy_install``:: @@ -59,61 +55,51 @@ Or get the latest development version using mercurial or git:: hg clone https://bitbucket.org/tomchristie/django-rest-framework git clone git@github.com:tomchristie/django-rest-framework.git -Or you can download the current release: - -* `django-rest-framework-0.1.tar.gz <https://bitbucket.org/tomchristie/django-rest-framework/downloads/django-rest-framework-0.1.tar.gz>`_ -* `django-rest-framework-0.1.zip <https://bitbucket.org/tomchristie/django-rest-framework/downloads/django-rest-framework-0.1.zip>`_ - -and then install Django REST framework to your ``site-packages`` directory, by running the ``setup.py`` script:: +Or you can `download the current release <http://pypi.python.org/pypi/djangorestframework>`_. - python setup.py install +Setup +----- -**To add django-rest-framework to a Django project:** +To add Django REST framework to a Django project: * Ensure that the ``djangorestframework`` directory is on your ``PYTHONPATH``. * Add ``djangorestframework`` to your ``INSTALLED_APPS``. -For more information take a look at the :ref:`setup` section. +For more information on settings take a look at the :ref:`setup` section. 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 djangorestframework import ModelResource, RootModelResource - from models import MyModel + from djangorestframework.resources import ModelResource + from djangorestframework.views import ListOrCreateModelView, InstanceModelView + from myapp.models import MyModel + + class MyResource(ModelResource): + model = MyModel urlpatterns = patterns('', - url(r'^$', RootModelResource.as_view(model=MyModel)), - url(r'^(?P<pk>[^/]+)/$', ModelResource.as_view(model=MyModel), name='my-model'), - ) - -`models.py`:: - - class MyModel(models.Model): - - # (Rest of model definition...) - - @models.permalink - def get_absolute_url(self): - return ('my-model', (self.pk,)) + url(r'^$', ListOrCreateModelView.as_view(resource=MyResource)), + url(r'^(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=MyResource)), + ) Django REST framework comes with two "getting started" examples. -#. :ref:`resources` -#. :ref:`modelresources` +#. :ref:`views` +#. :ref:`modelviews` Examples -------- There are a few real world web API examples included with Django REST framework. -#. :ref:`objectstore` - Using :class:`.Resource` for resources that do not map to models. -#. :ref:`codehighlighting` - Using :class:`.Resource` with forms for input validation. -#. :ref:`blogposts` - Using :class:`.ModelResource` for resources that map directly to models. +#. :ref:`objectstore` - Using :class:`views.View` classes for APIs that do not map to models. +#. :ref:`codehighlighting` - Using :class:`views.View` classes with forms for input validation. +#. :ref:`blogposts` - Using :class:`views.ModelView` classes for APIs that map directly to models. All the examples are freely available for testing in the sandbox: @@ -148,6 +134,7 @@ Library Reference library/renderers library/resource library/response + library/serializer library/status library/views @@ -157,8 +144,8 @@ Examples Reference .. toctree:: :maxdepth: 1 - examples/resources - examples/modelresources + examples/views + examples/modelviews examples/objectstore examples/pygments examples/blogpost |
