bgneal@695: """Admin definitions for the user_photos application.""" bgneal@695: from django.contrib import admin bgneal@695: bgneal@695: from user_photos.models import Photo bgneal@695: bgneal@703: IMG_TAG = 'thumbnail' bgneal@695: bgneal@695: class PhotoAdmin(admin.ModelAdmin): bgneal@695: date_hierarchy = 'upload_date' bgneal@695: ordering = ['-upload_date'] bgneal@695: raw_id_fields = ['user'] bgneal@695: search_fields = ['user__username', 'user__email'] bgneal@703: list_display = ['__unicode__', 'thumbnail'] bgneal@703: bgneal@703: def thumbnail(self, obj): bgneal@703: return IMG_TAG % obj.thumb_url bgneal@703: thumbnail.allow_tags = True bgneal@695: bgneal@695: admin.site.register(Photo, PhotoAdmin)