Search code examples
pythonsqldjangoapitastypie

Create ,UPDATE and DELETE call using django-tastypie


I am using django-tastypie to build the API for my project. I followed the tastypie-doc.

Using this doc I am able to call the GET method and filter the data based on the parameter. But I couldn't find any examples for PUT(UPDATE), DELETE (delete object) and POST(Create a new object).

Does anyone know how to write a call to create, update and delete in django-tastypie?

Thanks to all.


Solution

  • post_list and other post commands are CREATEs, while puts are updates and deletes are deletes. There are also obj_ methods that implement these methods.

    You can also take a look at the examples at http://django-tastypie.readthedocs.org/en/latest/cookbook.html which show how to do each of the basic actions.

    Also, try some general Django tutorials, as they should also provide you with relevant information.