[Answer]-Django Admin Sorl-Thumbnail Link

1👍

You are using the variable twice in the string, so you need to supply it twice:

return u'<a href="/im_troubleticket/media/%s"><img src="/im_troubleticket/media/%s"></a>' % (s, s)

EDIT: You have two new bugs in your code: First, you misspelled obj.screenshot. Second, the placeholders in your string indicate the type of data, not the name of the variable. See Python String Formatting. If you use descriptive variable names you are less likely to confuse the s in %s with the name of the variable.

thumb_small = get_thumbnail(obj.screenshot,"x200",crop='center', quality=99)
thumb_large = get_thumbnail(obj.screenshot,"x500",crop='center', quality=99)                

return u'<a href="/im_troubleticket/media/%s"><img src="/im_troubleticket/media/%s"></a>' % (thumb_small, thumb_large)

Leave a comment