Open btimby opened 5 years ago
I needed this too, so I forked and threw something together. Here's my commit. It works for ModelSerializers, but not plain serializers, and has no tests, so it's only a starting point if you want to build a PR off of it.
Also note that QueryFieldsMixin prevents the serialization of fields, but not the querying in whatever uses the serializer. If you're optimizing for expensive queries, instead of expensive serialization, you'll need to optimize elsewhere too.
I have a field that I want to exclude by default and only include when requested. This is currently not possible (AFAICT).
Any insight on how I could implement this in a PR?
Thanks.