From 8c3358a60bf6e39b2ea4d697136ccff7410ca8da Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Fri, 9 Feb 2018 15:35:40 -0500 Subject: [PATCH] Show badge images in Admin interface --- accounts/admin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/accounts/admin.py b/accounts/admin.py index 51e6cef..06887af 100644 --- a/accounts/admin.py +++ b/accounts/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin +from django.utils.safestring import mark_safe from .models import Account, Badge, BadgeGrant @@ -8,7 +9,10 @@ class AccountAdmin(admin.ModelAdmin): admin.site.register(Account, AccountAdmin) class BadgeAdmin(admin.ModelAdmin): - list_display = ('name', 'img_url') + list_display = ('name', 'icon', 'img_url') + def icon(self, obj): + return (mark_safe('' % (obj.img_url, obj.name))) + icon.short_description = 'Icon' admin.site.register(Badge, BadgeAdmin) class GrantAdmin(admin.ModelAdmin):