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')