changeset 719:cc8de231df5a

User photos in admin now have link to full size image.
author Brian Neal <bgneal@gmail.com>
date Thu, 19 Sep 2013 18:57:47 -0500
parents bf5340705d0c
children e0e79451339d
files user_photos/admin.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/user_photos/admin.py	Wed Sep 18 21:34:05 2013 -0500
+++ b/user_photos/admin.py	Thu Sep 19 18:57:47 2013 -0500
@@ -3,7 +3,7 @@
 
 from user_photos.models import Photo
 
-IMG_TAG = '<img src="%s" alt="thumbnail" />'
+IMG_TAG = """<a href="{url}"><img src="{thumb_url}" alt="thumbnail" /></a>"""
 
 class PhotoAdmin(admin.ModelAdmin):
     date_hierarchy = 'upload_date'
@@ -13,7 +13,7 @@
     list_display = ['__unicode__', 'thumbnail']
 
     def thumbnail(self, obj):
-        return IMG_TAG % obj.thumb_url
+        return IMG_TAG.format(url=obj.url, thumb_url=obj.thumb_url)
     thumbnail.allow_tags = True
 
 admin.site.register(Photo, PhotoAdmin)