From 2e7123989fb20dc306e8b57fc88ff83cec02c14a Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Sun, 4 Feb 2018 21:27:43 +0100 Subject: [PATCH] fix #19 - Chronologies : ajout d'une colonne "Plateforme" et filtrage dessus --- collection/games/admin.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/collection/games/admin.py b/collection/games/admin.py index 936e5c9..9a588a7 100644 --- a/collection/games/admin.py +++ b/collection/games/admin.py @@ -81,8 +81,18 @@ class GameAdmin(admin.ModelAdmin): class TimelineAdmin(admin.ModelAdmin): - list_display = ('date', 'status', 'item') + list_display = ('date', 'status', 'item', 'get_platform') search_fields = ('item__name', ) + list_filter = ('item__collection__shortname', ) + + def get_platform(self, obj): + """ + Display platform shortname + """ + return obj.item.collection.shortname + + get_platform.short_description = _('Platform') + get_platform.admin_order_field = ('item__collection__shortname') admin.site.register(Platform, PlatformAdmin)