Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing restful servers with Django for Dojo's JsonRestStore - Which tools for the job?

I'm writing some restful serverside resources which talk with dojo's JsonRestStore (JRS) on the client-side:

http://dojotoolkit.org/reference-guide/dojox/data/JsonRestStore.html

I notice that there are a couple of projects that I may be able to leverage to help create restful resources (i.e. to expose simple CRUD operations on Django models):

http://code.google.com/p/django-rest-interface/

and

http://django-rest-framework.org/

I'm confident that I could write the restful serverside interface for Dojo's JRS from scratch, but I don't want to reinvent any wheels, so, my questions are:

What's the difference between the above projects?

Will either help me with the stated goal?

Are there any others projects I might want to look at for this task?

Note that there are some specific details of the way that JRS makes requests and expects responses that I will need to implement. Here's a couple of (incomplete) examples so that you know what I'm talking about. Creation: respond with status of 201 and a Location: /path/id header for the newly created resource. Collections: parse the Range: items=x-y header and use this to paginate a response. Respond with the Content-Range: items x-z header. Serialise models in JSON as a list of dictionaries for collections, or a simple dictionary for single items.

like image 891
jsw Avatar asked Jan 25 '26 08:01

jsw


1 Answers

I'd take a look at piston, tastypie and django-rest-framework, honestly they're mostly pretty similar, I'd just take a run through the docs and see which you think fits the bill.

I don't think any of those will natively support the Range pagination you mention it's probably something you'd need to deal with yourself.

Piston is the daddy, tho not being actively maintained ATM, that's not necessarily and issue as it pretty much does what you want anyway. Tastypie's advantages are that it has a great community behind it, and is well documented. django-rest-framework has the admin style API browser, plenty of examples in the docs, and a growing community. django-rest-interface is perfectly decent AFAIK, but I don't know of any community effort behind it ATM.

like image 187
Tom Christie Avatar answered Jan 26 '26 22:01

Tom Christie