سؤال

im using the new version of Sorl-thumbnail, but i cant show thumbs in django admin...

how ill use get_thumbnail() ?, just i can see the "cache" url of the images...

Thanks

هل كانت مفيدة؟

المحلول

i did it

from sorl.thumbnail import get_thumbnail
def thumb(self):
        if self.imagen:
            t = get_thumbnail(self.imagen,"50x50",crop='center', quality=99)
            return u'<img src="%s" />' % t.url            
        else:
            return u"None"
    thumb.short_description = 'Foto'
    thumb.allow_tags = True 

نصائح أخرى

It's a new version with beter docs too! :) http://thumbnail.sorl.net/examples.html#admin-examples (This is for displaying images in forms, not in listing).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top