##// END OF EJS Templates
More columns for tag and thread admin
neko259 -
r1356:4d767fbf default
parent child Browse files
Show More
@@ -30,7 +30,10 b' class TagAdmin(admin.ModelAdmin):'
30 def thread_count(self, obj: Tag) -> int:
30 def thread_count(self, obj: Tag) -> int:
31 return obj.get_thread_count()
31 return obj.get_thread_count()
32
32
33 list_display = ('name', 'thread_count')
33 def display_children(self, obj: Tag):
34 return ', '.join([str(child) for child in obj.get_children().all()])
35
36 list_display = ('name', 'thread_count', 'display_children')
34 search_fields = ('name',)
37 search_fields = ('name',)
35
38
36
39
@@ -46,7 +49,14 b' class ThreadAdmin(admin.ModelAdmin):'
46 def ip(self, obj: Thread):
49 def ip(self, obj: Thread):
47 return obj.get_opening_post().poster_ip
50 return obj.get_opening_post().poster_ip
48
51
49 list_display = ('id', 'title', 'reply_count', 'archived', 'ip')
52 def display_tags(self, obj: Thread):
53 return ', '.join([str(tag) for tag in obj.get_tags().all()])
54
55 def op(self, obj: Thread):
56 return obj.get_opening_post_id()
57
58 list_display = ('id', 'op', 'title', 'reply_count', 'archived', 'ip',
59 'display_tags')
50 list_filter = ('bump_time', 'archived', 'bumpable')
60 list_filter = ('bump_time', 'archived', 'bumpable')
51 search_fields = ('id', 'title')
61 search_fields = ('id', 'title')
52 filter_horizontal = ('tags',)
62 filter_horizontal = ('tags',)
General Comments 0
You need to be logged in to leave comments. Login now