Answer the question
In order to leave comments, you need to log in
Why is sorl.thumbnail not outputting html?
Actually a question in a subject.
#model.py
class PostImages (models.Model):
post = models.ForeignKey (Post, null='True', blank='True')
image = models.ImageField(upload_to=None, height_field=None, width_field=None)
def thumb(self):
return '<img src="%s"/>' % (get_thumbnail(self.image, "50x50", crop='center', quality=95).url)
thumb.short_description = 'Photos'
thumb.allow_tags = True
#admin.py
class PostImagesAdmin(AdminImageMixin, admin.ModelAdmin):
list_display = ('thumb',)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question