3 ms·
For people who are unfamiliar, there is also Tastypie. I find it's Model centric approach a whole lot nicer to work with then Django-Rest .
by Illniyar 10y ago
For people who are unfamiliar, there is also Tastypie.
I find it's Model centric approach a whole lot nicer to work with then Django-Rest .
- tbarbugli 10y agoDid not use Tastypie since a couple years ago and I remember it being very hard to use due to be so heavily coupled to Django models. I find DRF support for Django ORM and yet the ease of use when not doing ORM stuff one the main selling points.
- dozzie 10y agoWhich is basically stupid by itself, as you simply expose your internal data structures without control or thought.
- tbarbugli 10y agocare to explain?
- dozzie 10y agoData structures used internally for processing are something totally different than data structures used for communication with outside world. Usually you don't want to expose internals with public API, and even when you do, you want to be very selective about what is shown and how. When you publish internals, you only cement your implementation so you can't change that easily later (e.g. when you realize how crappy it was at first), and you even need to pay for that drawback with ease of use of your API (API's user would need to understand the system he talks with). It's a lose-lose deal.
- tbarbugli 10y agoI agree, I find doing this with DRF very easy and had the opposite with TastyPie doing stuff I did not want or need. Having some ORM integration is nice; there are a number of situations where it's easy to use your ORM safely and get stuff done very quickly (eg. basic CRUD stuff for instance)
- dozzie 10y ago"Basic CRUD" is basic only in most trivial situations, which by themselves are rare. Much more often you need to create a set of related objects. With this "basic CRUD" you have many points where network can break, and network programming has one very important principle: network always breaks, so the program has to survive in such case.
- Illniyar 10y agoI'm guessing you haven't tried it. TastyPie gives you complete control and customization for all parts of your api.
- collyw 10y agoHaving tried both, I found DRF far more consistent with Django (making it a lot easier to work with as a result). ModelSerializers are similar to ModelForms and the class based views are almost the same.
- gtaylor 10y agoStrongly disagree. DRF can be used in a model centric way, has much easier to read source and drastically better documentation. The community is much more developed as well.
- hitekker 10y agoDitto with everyone else. Tastypie is unpleasant to build upon, except for the simple examples of their tutorial, and has rightfully been subsumed by DRF.