##// END OF EJS Templates
Show image previews in post's admin page
neko259 -
r1541:344601de default
parent child Browse files
Show More
@@ -38,7 +38,10 b' class PostAdmin(admin.ModelAdmin):'
38
38
39 def linked_images(self, obj: Post):
39 def linked_images(self, obj: Post):
40 images = obj.images.all()
40 images = obj.images.all()
41 image_urls = ['<a href="{}">{}</a>'.format(reverse('admin:%s_%s_change' %(image._meta.app_label, image._meta.model_name), args=[image.id]), image.hash) for image in images]
41 image_urls = ['<a href="{}"><img src="{}" /></a>'.format(
42 reverse('admin:%s_%s_change' % (image._meta.app_label,
43 image._meta.model_name),
44 args=[image.id]), image.image.url_200x150) for image in images]
42 return ', '.join(image_urls)
45 return ', '.join(image_urls)
43 linked_images.allow_tags = True
46 linked_images.allow_tags = True
44
47
General Comments 0
You need to be logged in to leave comments. Login now