Getting started with Django-ROA

Basic use

inherit from django_roa.Manager for your own managers if you'd like to extend/modify the default one.

inherit from django_roa.ModelAdmin for your own admin if you'd like to set custom options.

define get_resource_url_list static method in your models to access your remote resource in a RESTful way. Optionally, use get_resource_url_detail method for your model in order to define your own detail url, default is <resource_url_list><resource_url_detail>/

How does it works

Each time a request is passed to the database, an HTTP request is done to the remote server with the right method (GET, POST, PUT or DELETE) given the get_resource_url_* methods specified in the model's definition.

A little example

Here is a fully functional example (abstract from example project, see tests too):

Installation notes

Python 2.4+ and Django 1.2 alpha. Py-restclient 1.3.2 is included, it will use pycurl, urllib2 or httplib2. Django-piston 0.2.1 is included too. Those dependencies will be removed from the distribution of the project once it's stabilized.

You just need to add the django_roa application into your settings:

add django_roa to your INSTALLED_APPS setting:

INSTALLED_APPS = (
'django_roa',
etc
)

add ROA_MODELS = True in your settings.

specify the mapping of applications' names in your ROA_MODEL_NAME_MAPPING setting: