Django Rest Framework with easy-thumbnails
Best solution is probably to subclass serializers.ImageField()
and use the the code you found in the to_representation
method (docs for custom fields). Your field could then look like this:
from easy_thumbnails.templatetags.thumbnail import thumbnail_url
class ThumbnailSerializer(serializers.ImageField):
def to_representation(self, instance):
return thumbnail_url(instance, 'small')