Ravi said the following on 03/11/2014 08:18 PM:
Ravi, is your API returning JSON/XML data or pre-rendered HTML chunks?
The client should send an `accept` header with the appropriate MIME type
like application/json or text/html. If the endpoint doesn't support the
requested MIME type, it should return a HTTP 406 - Not Acceptable
response because the API doesn't support the requested data format.
In Django Rest Framework, you need to write a custom serializer for each
object you are returning:
http://www.django-rest-framework.org/api-guide/serializers
Once you have an object serializer, then you can past it to a built-in
parser (like JSON, XML, etc) which marshals data between the target
format and native Python.
Whereas Tastypie uses meta data from your object and some configuration
to "create" custom serializers and parsers for you automatically:
http://django-tastypie.readthedocs.org/en/latest/serialization.html
I found that Django Rest Framework just a lot of extra typing for extra
power (unless you want that control). I've found this part to be the
most tedious part of Django Rest and makes TastyPie a lot more easy to
use especially if you have a large model.
So if you have to reuse stuff in your views, you might look at the
Cookbook entry in using API resources in regular Django Views:
http://django-tastypie.readthedocs.org/en/latest/cookbook.html#using-your-resource-in-regular-views