Mercurial > public > sg101
view user_photos/admin.py @ 703:d7a0aaabc06c
Display thumbnail in user_photos admin.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 14 Sep 2013 18:43:10 -0500 |
parents | 2d35e5f97a99 |
children | cc8de231df5a |
line wrap: on
line source
"""Admin definitions for the user_photos application.""" from django.contrib import admin from user_photos.models import Photo IMG_TAG = '<img src="%s" alt="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)