norbert_mate
Re:Django Rest Framework general model serializer
on Friday January 30, 2015 @05:28PM (#8974903)
Hi languagehacker,
this is not science fiction. It just shows you a way of implementing a serializer that works for all kind of models in Django Rest Framework.
Re:Django Rest Framework general model serializer
on Friday January 30, 2015 @10:43AM (#8972521)
Thanks.
Re:Django Rest Framework general model serializer
on Friday January 30, 2015 @07:59AM (#8971756)
"The best documentation is the source code" :-) . I use to read it but sometimes is really hard to understand what's going on. As you said the serializer does a lot of thing.
Re:Django Rest Framework general model serializer
on Friday January 30, 2015 @07:37AM (#8971695)
Correct. It's very easy to create a simple model serializer and this is what the general model serializer does. It's no big deal just saves a few line of code.
Re:Django Rest Framework general model serializer
on Friday January 30, 2015 @07:34AM (#8971687)
I agree with you. It is a bit weird that a serializer can interact with the database but what it basically does: hides the database interaction.
Re:Django Rest Framework general model serializer
on Friday January 30, 2015 @07:20AM (#8971663)
In Django Rest Framework (DRF) you need serializer class. Maybe this is because DRF is not tightly coupled with the models from Django framework.
As far as I know DRF does not support PUT/UPDATE operations for nested serializers. But there are cases when you just need to read. Like getting an activity feed which can't be modified directly by the users. I think if you have a good caching system it's better to return all the data for one request instead of creating new requests to get details about each entity.