# HG changeset patch # User Brian Neal # Date 1379202190 18000 # Node ID d7a0aaabc06cb46525390abb9bf82dc3716e84ff # Parent 1fd0f88480bc6e73cd1fea9c5706b3cac1188337 Display thumbnail in user_photos admin. diff -r 1fd0f88480bc -r d7a0aaabc06c user_photos/admin.py --- a/user_photos/admin.py Sat Sep 14 18:31:39 2013 -0500 +++ b/user_photos/admin.py Sat Sep 14 18:43:10 2013 -0500 @@ -3,11 +3,17 @@ from user_photos.models import Photo +IMG_TAG = 'thumbnail' class PhotoAdmin(admin.ModelAdmin): date_hierarchy = 'upload_date' ordering = ['-upload_date'] raw_id_fields = ['user'] search_fields = ['user__username', 'user__email'] + list_display = ['__unicode__', 'thumbnail'] + + def thumbnail(self, obj): + return IMG_TAG % obj.thumb_url + thumbnail.allow_tags = True admin.site.register(Photo, PhotoAdmin)