3 ms·
The big problem for me is that serializers are bidirectional. They should only work in one direction: server to client. Client to server should be either handle
by IgorPartola 12y ago
The big problem for me is that serializers are bidirectional. They should only work in one direction: server to client. Client to server should be either handled by a wrapper around Django form or by a separate deserializer type. Why? Take a simple example: you have a game character model which consists of things like name, color, and a set of randomly generated attributes such as strength, agility, etc. Now, you wan the server to generate the attributes, but not the name and the color. You write your code, do a POST to /characters/ and BAM: {"strength": ["This field is required."], ...}. Now you have to tell the serializer that this field is not required...
Oh, and try customizing error messages or providing customer error conditions... It's just not fun. I think this is the weakest part of DRF.