Closed adieyal closed 10 years ago
We're only using a single endpoint in the API at the moment, so I thought it might be an overkill to use a dedicated API extension for that. I'm rather enjoying the fine-grained control over serialization. And I thought the model would be the best place to define that logic.
But let me know if you feel strongly about changing this approach.
Serialization now happens in serializers.py
.
Instead of writing code from scratch - rather use best practices. For object serialisation, http://flask-restful.readthedocs.org/en/latest/ seems to be the standard solution for flash.
In general, serialisation code should not be tied to a particular model. Instead, you should use external serialisers so as to ensure that models only represent business logic and don't include any other confusing code. Also, external serialisers allow for more flexibility if you want different serialisations of the same model.