Created
January 13, 2012 04:13
-
-
Save armonge/1604653 to your computer and use it in GitHub Desktop.
Show an image in django admin list_display, using sorl-thumbnail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProductAdmin(admin.ModelAdmin): | |
list_display = ('name','thumb') | |
def thumb(self, obj): | |
return render_to_string('thumb.html',{ | |
'image': obj.image | |
}) | |
thumb.allow_tags = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load thumbnail %} | |
{% thumbnail image '100x100' crop="top" as im %} | |
<img src="{{ im.url }}" alt=""> | |
{% endthumbnail %} |
thank you very much!
where is your thumb.html??
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So simple!