def thumbnail(self): """ Display thumbnail-size image of ImageField named src Assumes images are not very large (i.e. no manipulation of the image is done on backend) Requires constant named MAX_THUMB_LENGTH to limit longest axis """ max_img_length = max(self.get_src_width(), self.get_src_height()) ratio = max_img_length > MAX_THUMB_LENGTH and float(max_img_length) / MAX_THUMB_LENGTH or 1 thumb_width = self.get_src_width() / ratio thumb_height = self.get_src_height() / ratio url = '%s%s' % (settings.ADMIN_MEDIA_PREFIX, self.get_src_url()) return '' % (url, thumb_width, thumb_height) thumbnail.short_description = 'Image thumbnail' thumbnail.allow_tags = True class Admin: list_display = ('src', 'thumbnail',)