4 ms·
Django REST framework inherits its Views from Django's Class-Based Views. If your app is using CBVs elsewhere, it is one less interface to have to get familiar
by megaman821 13y ago
Django REST framework inherits its Views from Django's Class-Based Views. If your app is using CBVs elsewhere, it is one less interface to have to get familiar with. When I need to do something a little advanced the familiar methods get(), post(), dispatch(), get_queryset(), etc are present. Also, most Mixins for Django's CBVs work fine with Django REST framework's Views. Django REST framework separates its logic into two main classes Serializers and Views, compare to Django TastyPie which combines these concepts into a class called a Resource. A Resource also combines what is a ListAPIView and RetrieveAPIView in Django Rest framework, but having them seperate can let you do things like return different model fields for the ListAPIView verus the RetrieveAPIView. Django REST framework's standout feature is the browsable API, which lets explore the API from your browser.
TastyPie is more "complete" than Django REST framework. It has URL routing, which makes setting up an API namespace in your URLs super simple. It has queryset filtering from the URL (e.g. /articles/?author=1). Django REST framework relies on another third-party app to do this. It also has caching built-in. I find it's internal interface a little bit more confusing the Django REST framework's, but that could be that I am just more familiar with Django CBVs.
- manojlds 13y ago> It(Tastypie) has URL routing, which makes setting up an API namespace in your URLs super simple. Isn't that something that this release has added, and the new release, is, the main theme of this discussion.