Show More
@@ -1,26 +1,40 b'' | |||
|
1 | 1 | from django.contrib import admin |
|
2 | from boards.models import Post, Tag, User, Ban | |
|
2 | from boards.models import Post, Tag, User, 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', 'linked') |
|
15 | 15 | list_filter = ('linked',) |
|
16 | 16 | |
|
17 | 17 | |
|
18 | 18 | class UserAdmin(admin.ModelAdmin): |
|
19 | 19 | |
|
20 | 20 | list_display = ('user_id', 'rank') |
|
21 | 21 | search_fields = ('user_id',) |
|
22 | 22 | |
|
23 | ||
|
24 | class ThreadAdmin(admin.ModelAdmin): | |
|
25 | ||
|
26 | def title(self, obj): | |
|
27 | return obj.get_opening_post().title | |
|
28 | ||
|
29 | def reply_count(self, obj): | |
|
30 | return obj.get_reply_count() | |
|
31 | ||
|
32 | list_display = ('id', 'title', 'reply_count', 'archived') | |
|
33 | list_filter = ('bump_time', 'archived') | |
|
34 | search_fields = ('id', 'title') | |
|
35 | ||
|
23 | 36 | admin.site.register(Post, PostAdmin) |
|
24 | 37 | admin.site.register(Tag, TagAdmin) |
|
25 | 38 | admin.site.register(User, UserAdmin) |
|
26 | 39 | admin.site.register(Ban) |
|
40 | admin.site.register(Thread, ThreadAdmin) |
General Comments 0
You need to be logged in to leave comments.
Login now