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