How to use Sorl-thumbnail in Ajax requests

I have a project where the sorl-thumbnail plugin works very well in admin, however I am having some problems implementing thumbnails in Ajax Requests.

Using sorl in combination with django-ajax-selects when trying to return

(where MyImageField

is the type sorl.thumbnail.ImageField

) for a call, I get an HTTP response 500 INTERNAL SERVER ERROR

from my development server. All other attributes can be returned ok, and when I configure pdb and view the object whose attribute .photo.url

I am trying to return url

is there and valid.

Is this really going to be a problem to the point that sorl makes an asynchronous request to the database that takes longer than an HTTP request?

Very important, as always, for your input

EDIT: my images are stored in S3, which I admit can cause an extra layer of complexity if sorl is required to create a new sketch for an object ImageField


source to share

All Articles