# HG changeset patch # User neko259 # Date 2015-01-03 19:38:02 # Node ID e03b1ba92d71224fae0574a2e9f673bc4433647d # Parent ffe54c087468def5c4f2c29bb516af1e1fb79035 Small admin changes diff --git a/boards/admin.py b/boards/admin.py --- a/boards/admin.py +++ b/boards/admin.py @@ -15,20 +15,23 @@ class PostAdmin(admin.ModelAdmin): @admin.register(Tag) class TagAdmin(admin.ModelAdmin): - list_display = ('name',) + def thread_count(self, obj: Tag) -> int: + return obj.get_thread_count() + + list_display = ('name', 'thread_count') search_fields = ('name',) @admin.register(Thread) class ThreadAdmin(admin.ModelAdmin): - def title(self, obj): + def title(self, obj: Thread) -> str: return obj.get_opening_post().get_title() - def reply_count(self, obj): + def reply_count(self, obj: Thread) -> int: return obj.get_reply_count() - def ip(self, obj): + def ip(self, obj: Thread): return obj.get_opening_post().poster_ip list_display = ('id', 'title', 'reply_count', 'archived', 'ip')