Show More
@@ -1,26 +1,40 b'' | |||||
1 | from django.contrib import admin |
|
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 | class PostAdmin(admin.ModelAdmin): |
|
5 | class PostAdmin(admin.ModelAdmin): | |
6 |
|
6 | |||
7 | list_display = ('id', 'title', 'text') |
|
7 | list_display = ('id', 'title', 'text') | |
8 | list_filter = ('pub_time', 'thread_new') |
|
8 | list_filter = ('pub_time', 'thread_new') | |
9 | search_fields = ('id', 'title', 'text') |
|
9 | search_fields = ('id', 'title', 'text') | |
10 |
|
10 | |||
11 |
|
11 | |||
12 | class TagAdmin(admin.ModelAdmin): |
|
12 | class TagAdmin(admin.ModelAdmin): | |
13 |
|
13 | |||
14 | list_display = ('name', 'linked') |
|
14 | list_display = ('name', 'linked') | |
15 | list_filter = ('linked',) |
|
15 | list_filter = ('linked',) | |
16 |
|
16 | |||
17 |
|
17 | |||
18 | class UserAdmin(admin.ModelAdmin): |
|
18 | class UserAdmin(admin.ModelAdmin): | |
19 |
|
19 | |||
20 | list_display = ('user_id', 'rank') |
|
20 | list_display = ('user_id', 'rank') | |
21 | search_fields = ('user_id',) |
|
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 | admin.site.register(Post, PostAdmin) |
|
36 | admin.site.register(Post, PostAdmin) | |
24 | admin.site.register(Tag, TagAdmin) |
|
37 | admin.site.register(Tag, TagAdmin) | |
25 | admin.site.register(User, UserAdmin) |
|
38 | admin.site.register(User, UserAdmin) | |
26 | admin.site.register(Ban) |
|
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