Show More
@@ -15,20 +15,23 b' class PostAdmin(admin.ModelAdmin):' | |||
|
15 | 15 | @admin.register(Tag) |
|
16 | 16 | class TagAdmin(admin.ModelAdmin): |
|
17 | 17 | |
|
18 | list_display = ('name',) | |
|
18 | def thread_count(self, obj: Tag) -> int: | |
|
19 | return obj.get_thread_count() | |
|
20 | ||
|
21 | list_display = ('name', 'thread_count') | |
|
19 | 22 | search_fields = ('name',) |
|
20 | 23 | |
|
21 | 24 | |
|
22 | 25 | @admin.register(Thread) |
|
23 | 26 | class ThreadAdmin(admin.ModelAdmin): |
|
24 | 27 | |
|
25 | def title(self, obj): | |
|
28 | def title(self, obj: Thread) -> str: | |
|
26 | 29 | return obj.get_opening_post().get_title() |
|
27 | 30 | |
|
28 | def reply_count(self, obj): | |
|
31 | def reply_count(self, obj: Thread) -> int: | |
|
29 | 32 | return obj.get_reply_count() |
|
30 | 33 | |
|
31 | def ip(self, obj): | |
|
34 | def ip(self, obj: Thread): | |
|
32 | 35 | return obj.get_opening_post().poster_ip |
|
33 | 36 | |
|
34 | 37 | list_display = ('id', 'title', 'reply_count', 'archived', 'ip') |
General Comments 0
You need to be logged in to leave comments.
Login now