Show More
@@ -1,36 +1,38 b'' | |||
|
1 | 1 | from django.contrib import admin |
|
2 | 2 | from boards.models import Post, Tag, Ban, Thread |
|
3 | 3 | |
|
4 | 4 | |
|
5 | 5 | class PostAdmin(admin.ModelAdmin): |
|
6 | 6 | |
|
7 | 7 | list_display = ('id', 'title', 'text') |
|
8 | 8 | list_filter = ('pub_time', 'thread_new') |
|
9 | 9 | search_fields = ('id', 'title', 'text') |
|
10 | 10 | |
|
11 | 11 | |
|
12 | 12 | class TagAdmin(admin.ModelAdmin): |
|
13 | 13 | |
|
14 | 14 | list_display = ('name',) |
|
15 | 15 | |
|
16 | ||
|
16 | 17 | class ThreadAdmin(admin.ModelAdmin): |
|
17 | 18 | |
|
18 | 19 | def title(self, obj): |
|
19 | return obj.get_opening_post().title | |
|
20 | return obj.get_opening_post().get_title() | |
|
20 | 21 | |
|
21 | 22 | def reply_count(self, obj): |
|
22 | 23 | return obj.get_reply_count() |
|
23 | 24 | |
|
24 | 25 | list_display = ('id', 'title', 'reply_count', 'archived') |
|
25 | 26 | list_filter = ('bump_time', 'archived') |
|
26 | 27 | search_fields = ('id', 'title') |
|
27 | 28 | |
|
29 | ||
|
28 | 30 | class BanAdmin(admin.ModelAdmin): |
|
29 | 31 | list_display = ('ip', 'can_read') |
|
30 | 32 | list_filter = ('can_read',) |
|
31 | 33 | search_fields = ('ip',) |
|
32 | 34 | |
|
33 | 35 | admin.site.register(Post, PostAdmin) |
|
34 | 36 | admin.site.register(Tag, TagAdmin) |
|
35 | 37 | admin.site.register(Ban, BanAdmin) |
|
36 | 38 | admin.site.register(Thread, ThreadAdmin) |
General Comments 0
You need to be logged in to leave comments.
Login now