Sometimes, you want to annotate a value to be used by the serializer. Currently, it has to be handled manually, and it does not play well with chained serializers. It would be nice to be able to do something like:
def add_annotations(self, context):
return (
{
"field": "some_field_count",
"annotation": Count("someField", distinct=True)
},
)
It should handle chaining properly and allow all types of annotations.